Solvedangular Error upgrading to Angular 6: Cannot redeclare block-scoped variable 'ngDevMode'

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report 
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Just update angular from 5.2 to 6.0.3 following angular but
if I try to serve the application I have this error:

ERROR in ../node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'. node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.

ng update says it is all updated.

For Tooling issues:

  • Node version: v8.9.4
  • Platform: Windows
17 Answers

✔️Accepted Answer

This tsconfig.json works for me

{ "compilerOptions": { "baseUrl": "", "allowSyntheticDefaultImports": true, "declaration": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "dom", "es2015" ], "module": "es2015", "moduleResolution": "node", "sourceMap": true, "target": "es5", "paths": { "@angular/*": ["node_modules/@angular/*"] } }, "include": [ "src/**/*.ts", "node_modules/ng4-fittext/*.d.ts" ], "exclude": [ ], "compileOnSave": false, "atom": { "rewriteTsconfig": false } }

Other Answers:

@hilkojj I'm not sure, but I had to set manually the path "paths": { "@angular/": ["node_modules/@angular/"] } to compiler. I think this config will be imported to tsconfig automatically in the future.

For ionic app, I had to update tsconfig.json at root of my project with:
{
"compilerOptions": {
"baseUrl": "",
...

"paths": { 
  "@angular/*": ["node_modules/@angular/*"] 
}

},
...
}

More Issues: