ERROR in node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
lilworks opened this issue · 5 comments
Just declaring AudioContextModule in module.ts
import { AudioContextModule } from 'angular-audio-context';
I get 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-audio-context/node_modules/@angular/core/src/application_init.d.ts(26,21): error TS1039: Initializers are not allowed in ambient contexts.
node_modules/angular-audio-context/node_modules/@angular/core/src/ivy_switch/compiler/ivy_switch_on.d.ts(12,35): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal.
node_modules/angular-audio-context/node_modules/@angular/core/src/ivy_switch/compiler/legacy.d.ts(19,35): error TS1254: A 'const' initializer in an ambient context must be a string or numeric literal.
node_modules/angular-audio-context/node_modules/@angular/core/src/linker/query_list.d.ts(36,22): error TS1039: Initializers are not allowed in ambient contexts.
node_modules/angular-audio-context/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts(9,11): error TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
Here is my current angular-cli version
ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.0.3
Node: 8.11.1
OS: darwin x64
Angular: 6.1.7
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.8
@angular-devkit/build-angular 0.6.8
@angular-devkit/build-optimizer 0.6.8
@angular-devkit/core 0.6.8
@angular-devkit/schematics 7.0.3
@angular/animations 6.1.9
@angular/cli 7.0.3
@ngtools/webpack 6.0.8
@schematics/angular 7.0.3
@schematics/update 0.10.3
rxjs 6.3.2
typescript 2.7.2
webpack 4.8.3
Hi @lilworks, thanks for reporting this. I guess this is happening because angular-audio-context defines @angular/... as dependencies (instead of peer dependencies). It looks like you have two versions of Angular now which are competing.
Can you please run npm ls @angular/core
to check how many versions of Angular you currently have. If there is more than one you can run npm dedupe
to get rid of the duplicates.
Please let me know if this works.
Thanks for your response...
Here the result of npm ls @angular/core
I just see one version
npm ls @angular/core
jolineck@0.0.0 /Users/lil-works1/Webdisk/www/npm/jolineck
└─┬ angular-audio-context@18.0.0
└── @angular/core@7.0.1
Sorry, just tried running npm ls @angular/core
myself and realized that it returns strange results.
I also saw that you are using Angular v6.1.7. Maybe that is the cause of the error. Since v18 of angular-audio-context it only supports Angular v7. Angular v6 was supported in the versions below 18.
Can you try npm i angular-audio-context@17
to pin the version to v17.
Alternatively you could try running ng update @angular/cli @angular/core
to update Angular itself.
Hi @lilworks, were you able to solve the issue?
Version 19 does now define Angular as a peer dependency which should at least give you a warning when there is a version mismatch.
I don't know exactly how I solved it... It was certainly something related to my config. Thanks for your support