Windows 10
@angular/cli: 1.0.0-rc.1
node: 7.7.1
os: win32 x64
@angular/common: 4.0.0-rc.2
@angular/compiler: 4.0.0-rc.2
@angular/core: 4.0.0-rc.2
@angular/forms: 4.0.0-rc.2
@angular/http: 4.0.0-rc.2
@angular/platform-browser: 4.0.0-rc.2
@angular/platform-browser-dynamic: 4.0.0-rc.2
@angular/platform-server: 4.0.0-rc.2
@angular/router: 4.0.0-rc.2
@angular/animations: 4.0.0-rc.2
@angular/material: 2.0.0-beta.2
@angular/platform-webworker: 4.0.0-rc.2
@angular/platform-webworker-dynamic: 4.0.0-rc.2
@angular/cli: 1.0.0-rc.1
@angular/compiler-cli: 4.0.0-rc.2
1.) ng new myAPP -ng4 -si -sg --style=scss --routing -lc -v
1.1) cd myAPP
2.) yarn
3.) npm i bootstrap@next save
4.) ng serve
ERROR in Could not resolve module @angular/core/src/di/opaque_token
ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (C:\myAPPnode_modules\@ngtools\webpacknode_modules\typescript\lib\typescript.js:9426:20)
at Object.createCompilerHost (C:\myAPPnode_modules\@ngtools\webpacknode_modules\typescript\lib\typescript.js:62475:26)
at Object.ngcLoader (C:\myAPPnode_modules\@ngtools\webpack\src\loader.js:338:33)
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
ERROR in ./src/polyfills.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (C:\myAPPnode_modules\@ngtools\webpacknode_modules\typescript\lib\typescript.js:9426:20)
at Object.createCompilerHost (C:\myAPPnode_modules\@ngtools\webpacknode_modules\typescript\lib\typescript.js:62475:26)
at Object.ngcLoader (C:\myAPPnode_modules\@ngtools\webpack\src\loader.js:338:33)
@ multi ./src/polyfills.ts
Please Help for me
@CisSasGot - Jan Roman Cisowski
when I use npm instead of yarn issue disappeared
I am also facing same issue...
Had same error. Deleting node_modules and reinstalling global angular-cli resolved my issue. (though I'm still on angular 2.4.9)
since you use Angular 4, Opaque token is deprecated
https://github.com/angular/angular/blob/master/CHANGELOG.md#deprecations-1
@antonybudianto I'm not using angular4....
I tried upgrading my package.json to the latest angular4 and now that I have downgraded again to angular2.4.x I am receiving this error.
Fixed the issue, not entirely sure what it was....
I will say that my index.html was mal-formed (somehow?) so that may have also played a role.
Was getting the same opaque_token error. Cleaning npm cache did it for me:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
This error comes up when there is a mismatch of @angular/core versions somewhere. e.g your project is using 2.x but the CLI is installed with 4.x or vice versa. This can happen due to installing versions back and forth or something during updates. Reinstalling often fixes it.
In my case I did these steps:
and then install again, I am not sure whether it is always convenient install the latest version, in some cases some features have bugs. I prefer the stable version in this date.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Was getting the same opaque_token error. Cleaning npm cache did it for me:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest