ng2-nouislider: Aot typeerror

Version: 1.5.0 Angular2 version 2.4.5 as well as 2.4.6 Angular cli version 1.0.0-beta.30 as well as 1.0.0-beta.26

During aot serve I get this error. Any ideas?

ERROR in ./~/ng2-nouislider/src/nouislider.ts
Module build failed: TypeError: Cannot read property 'text' of undefined
    at Object.getTokenPosOfNode (/Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/typescript/lib/typescript.js:5687:71)
    at IdentifierObject.TokenOrIdentifierObject.getStart (/Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/typescript/lib/typescript.js:53619:23)
    at IdentifierObject.TokenOrIdentifierObject.getText (/Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/typescript/lib/typescript.js:53640:77)
    at /Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/@ngtools/webpack/src/loader.js:119:42
    at Array.filter (native)
    at /Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/@ngtools/webpack/src/loader.js:118:14
    at Array.forEach (native)
    at _removeDecorators (/Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/@ngtools/webpack/src/loader.js:109:10)
    at /Users/tibinko/Documents/work/mates/frontend2/migration-project/node_modules/@ngtools/webpack/src/loader.js:282:48
 @ ./src/$$_gendir/app/modules/app.module.ngfactory.ts 42:0-58
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 18 (1 by maintainers)

Most upvoted comments

A radical workaround is to use replace the library by the file https://github.com/tb/ng2-nouislider/blob/master/src/nouislider.ts. Just copy it somewhere in your source folder and remove the library from the packages.json until the bug has been fixed.

I can confirm

Adding “@ngtools/webpack”: “1.2.3” to package.json resolved this issue for me.

I don’t think this issue should be closed though. We shouldn’t have to add this to our package.json. The dependencies for this package (ng2-nouislider) should be setup correctly to solve this issue.

Rock n roll, @tb, glad to be of help!

Can confirm. Am getting same error with simple ng build --prod. Error specifically points to ng2-nouislider’s ts.

ERROR in ./~/ng2-nouislider/src/nouislider.ts
Module build failed: TypeError: Cannot read property 'text' of undefined

I’m digging into it right now, and I will add my two cents’ worth that yes, when releasing, either things like this should be clarified in the instructions on a readme, or should be resolved within the package itself. I recognize that the landscape is still changing rapidly these days, but it is worth it to communicate upfront that a little housekeeping may be necessary to get a particular directive to work in any one person’s production environment.

I will post any updates if I find a working case that isn’t a hack.