question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Any file js, that has an "assert" string in it, throws an error.

See original GitHub issue

Bug report

What is the current behavior?

After i removed the package-lock.json and reinstalled i got this error.

If the current behavior is a bug, please provide the steps to reproduce.

It is a big project, i can’t reproduce, but could you please look at the error, because it only happens in files that have assert functions or imports.

What is the expected behavior? I think it is a patch in some of the packages, so no idea where it happend. What happens now is that any file that has assert in the file it will throw an error.

What is weird is that in the error it happens that has assert files:

[2] ERROR in ./node_modules/@uirouter/core/lib-esm/transition/hookBuilder.js 1:17
[2] Module parse failed: Unexpected token (1:17)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] > import { extend, assertPredicate, unnestR, identity } from '../common/common';
[2] | import { isArray } from '../common/predicates';
[2] | import { TransitionHookPhase, TransitionHookScope, } from './interface';
[2]  @ ./node_modules/@uirouter/core/lib-esm/transition/index.js 14:0-30 14:0-30
[2]  @ ./node_modules/@uirouter/core/lib-esm/index.js 6:0-35 6:0-35
[2]  @ ./node_modules/@uirouter/angularjs/lib-esm/index.js 16:0-39 17:0-16 18:0-31 18:0-31
[2]  @ ./src/client/vendor.js 34:0-30
[2] 
[2] ERROR in ./node_modules/@uirouter/core/lib-esm/vanilla/injector.js 1:17
[2] Module parse failed: Unexpected token (1:17)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] > import { extend, assertPredicate, isFunction, isArray, isInjectable, } from '../common/index';
[2] | // globally available injectables
[2] | var globals = {};
[2]  @ ./node_modules/@uirouter/core/lib-esm/vanilla/index.js 8:0-27 8:0-27
[2]  @ ./node_modules/@uirouter/core/lib-esm/vanilla.js 1:0-32 1:0-32
[2]  @ ./node_modules/@uirouter/core/lib-esm/index.js 11:0-26 11:0-26
[2]  @ ./node_modules/@uirouter/angularjs/lib-esm/index.js 16:0-39 17:0-16 18:0-31 18:0-31
[2]  @ ./src/client/vendor.js 34:0-30
[2] 
[2] ERROR in ./node_modules/angular-animate/angular-animate.js 64:9
[2] Module parse failed: Unexpected token (64:9)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] | 
[2] | var ngMinErr = angular.$$minErr('ng');
[2] > function assertArg(arg, name, reason) {
[2] |   if (!arg) {
[2] |     throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
[2]  @ ./node_modules/angular-animate/index.js 1:0-28
[2]  @ ./node_modules/angular-material/index.js 5:0-26
[2]  @ ./src/client/vendor.js 36:0-27
[2] 
[2] ERROR in ./node_modules/angular/angular.js 2115:9
[2] Module parse failed: Unexpected token (2115:9)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] |  * throw error if the argument is falsy.
[2] |  */
[2] > function assertArg(arg, name, reason) {
[2] |   if (!arg) {
[2] |     throw ngMinErr('areq', 'Argument \'{0}\' is {1}', (name || '?'), (reason || 'required'));
[2]  @ ./node_modules/angular/index.js 1:0-20
[2]  @ ./src/client/vendor.js 24:17-35
[2] 
[2] ERROR in ./node_modules/buffer/index.js 184:9
[2] Module parse failed: Unexpected token (184:9)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] | Object.setPrototypeOf(Buffer, Uint8Array)
[2] | 
[2] > function assertSize (size) {
[2] |   if (typeof size !== 'number') {
[2] |     throw new TypeError('"size" argument must be of type number')
[2]  @ ./node_modules/qrcode/lib/core/reed-solomon-encoder.js 3:13-37
[2]  @ ./node_modules/qrcode/lib/core/qrcode.js 10:25-58
[2]  @ ./node_modules/qrcode/lib/browser.js 4:13-37
[2]  @ ./src/client/angular/core/factory/ngivr-core-pdf-generator.js 57:43-60
[2]  @ ./src/client/injector.js 80:0-61
[2]  @ ./src/client/angular.js 17:0-24
[2]  @ ./src/client/main.js 148:0-20
[2]  @ ./src/client/main-development.js 6:19-47 29:0-17
[2] 
[2] ERROR in ./node_modules/jquery/dist/jquery.js 936:9
[2] Module parse failed: Unexpected token (936:9)
[2] You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
[2] |  * @param {Function} fn Passed the created element and returns a boolean result
[2] |  */
[2] > function assert( fn ) {
[2] |   var el = document.createElement( "fieldset" );
[2] | 
[2]  @ ./src/client/vendor.js 10:27-44
[2] 
[2] webpack 5.45.0 compiled with 6 errors in 287 ms
[2] ℹ 「wdm」: Failed to compile.

Other relevant information: webpack version: 5 latest Node.js version: 14 latest Operating System: Linux Mint latest Additional tools:

See this is the main errors, which is very weird:

The actual errors all assert:

function assert( fn ) {
function assertSize (size) {
function assertArg(arg, name, reason) {
function assertArg(arg, name, reason) {
import { extend, assertPredicate, isFunction, isArray, isInjectable, } from '../common/index';
import { extend, assertPredicate, unnestR, identity } from '../common/common';

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

13reactions
alexander-akaitcommented, Jul 16, 2021

Let’s keep open until we do patch release

1reaction
redonkuluscommented, Jul 16, 2021

I’m curious how the previous PR passed to merge that in, when the current one to fix this issue is not passing?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to assert that function throws with a specific error message
tests whether the thrown error has a particular message assert.throws(myFunction, { message: 'content of error.message goes here'});.
Read more >
Assert | Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >
Node.js assert.throws() Function - GeeksforGeeks
The assert.throws() is used when the code throws an exception based on a specific circumstances, to catch the error object for testing and ......
Read more >
Asserts - Node Tap
js's built-in assert module. A throw fails a test, so not-throwing passes. That does, however, mean that you won't generate a test point...
Read more >
assert-throws - npm
assert -throws is an assertion method for Node.js which checks if a synchronous or asynchronous function throws. It can also compare properties ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found