-
Notifications
You must be signed in to change notification settings - Fork 25.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TS2451: Cannot redeclare block-scoped variable 'ngDevMode'. #21925
Comments
I've had the same issue, because i used our own framework as a dependency. because the versions of both repo's had different angular versions i ended up with this error. When updated both repo's to the same angular version, the error disappeared. |
The problem is fundamentally here,
This causes TypeScript to bring in both the To state this more clearly, we don't support having two different versions of angular definitions in the same compilation. The simple way around this is to have module and app share the same copy of angular instead of having there own. In other words, move the package.json up one directory. If you require to have a separate compilation then I recommend using something like We are working to improve the ergonomics of libraries and is one of our primary focuses for this release cycle. For now, however, you need to ensure that only one copy of angular is found by the compiler or separately compile the modules using |
Shouldnt this be open? cant solve it in this project https://github.com/mariohmol/ang-jsoneditor This just works when angular/cli is 1.2.6 , with 1.7.x gives me this error |
Got this working, if u get here follow this discussion 👍 thanks |
I fixed it by updating my typescript dependency to "typescript": "2.5.3". |
I ran into this issue as well today, and tyholby's solution (upgrade typescript to 2.5.3) fixed it. |
Happening as well when upgrading from Angular 5.2 to 6.2 |
can confirm . this is happening in angular 6.0.3 as well. |
Can confirm too. Happening also on angular 6.0.4 |
Same for the following:
|
Same for the following:
|
have u guys tested/checked this #21670 (comment) ? |
My personal ones worked, I had a folder of node_modules in a previous project folder, this caused the error. It was this way:
|
Actually me it was also an error not related to angular-cli itself. I was using a custom npm library in which angular was imported. So im guessing it had to do with loading angular twice (?). |
@maurei Apparently yes, everywhere I noticed, the problem was due to two refills to the Angular, as in my case it was the duplication of the node_modules |
I had an Angular Library using @angular/core 6.0.7 and when upgrade my App from Angular 5 to Angular 6 I've had this error. Looking to my package.json file I noticed that all Angular dependencies were in versions 6.0.7. So, I changed all versions from 6.0.9 to 6.0.7 and now it works. How is the proper way to handle with it? |
I've added some logic to delete all node modules from my specific library which gives the error in the 'postinstall' script:
|
@rickvandermey, thanks it worked! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
From Angular 5.1.3 and before my compilation problem worked fine. Upon upgrading to 5.2.2 I now get ...
ERROR in [at-loader] ./node_modules/@angular/core/src/render3/ng_dev_mode.d.ts:9:11
TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
ERROR in [at-loader] ../module/node_modules/@angular/core/src/render3/ng_dev_mode.d.ts:9:11
TS2451: Cannot redeclare block-scoped variable 'ngDevMode'.
This is a continuation of issue 21670 with a now working repo.
Expected behavior
No compilation error.
Minimal reproduction of the problem with instructions
Check out this repo and follow the simple instructions...
https://github.com/crowmagnumb/ng-problem
What is the motivation / use case for changing the behavior?
Broken
Environment
The text was updated successfully, but these errors were encountered: