0
votes

I have the following error:

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

My tsconfig was like this previously:

 {
 "compilerOptions": {
  "baseUrl": "./",
  "outDir": "./dist/out-tsc",
  "sourceMap": true,
  "declaration": false,
  "module": "es2015",
  "moduleResolution": "node",
  "emitDecoratorMetadata": true,
  "experimentalDecorators": true,
   "target": "es5",
  "typeRoots": [
  "node_modules/@types"
  ],
  "lib": [
  "es2017",
  "dom"
   ],
  "paths": { "@angular/*": ["node_modules/@angular/*"] } 
   },
   }

So after browsing I have modified tsconfig like the below one. still Im getting the same error..

My tsconfig file:

 {
 "compilerOptions": {
 "baseUrl": "./",
 "outDir": "./dist/out-tsc",
 "sourceMap": true,
 "declaration": false,
 "module": "es2015",
 "moduleResolution": "node",
 "emitDecoratorMetadata": true,
 "experimentalDecorators": true,
 "target": "es5",
 "typeRoots": [
 "node_modules/@types"
 ],
 "lib": [
  "es2017",
  "dom"
 ],
  "paths": { "@angular/*": ["node_modules/@angular/*"] } 
 },
 }

Can anybody tell me how to solve this error in angular 6?

1

1 Answers

0
votes

You seems to have two versions of @angular/core in your project. One in src/node_modules and one in node_modules. You should try to delete the node_modules folders and launch npm install command.