Skip to content
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

npm install creates an additional node_modules folder #13

Closed
FlorianMathis opened this issue Jun 19, 2018 · 6 comments
Closed

npm install creates an additional node_modules folder #13

FlorianMathis opened this issue Jun 19, 2018 · 6 comments

Comments

@FlorianMathis
Copy link

Hi,

problem:
by installing jodit-angular there will be generated an additional node_modules folder which ends in following error: "Cannot redeclare block-schoped variable 'ngDevMode'.

solution
delete the generated node_modules folder (everything works fine then)

@xdan: Can you tell me why you locate another additional node_modules folder in your package?

@helix46
Copy link

helix46 commented Jun 19, 2018

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

@Shrewd
Copy link

Shrewd commented Jul 4, 2018

In my case, using wrong angular versions made the error occur.
Angular versions must match this library version, currently 5.2.11
I used npm update to do so, and then ng-bootstrap caused errors since it now requires angular 6.
Using npm install --save @ng-bootstrap/ng-bootstrap@2.0.0 did the trick

@Iskuzer
Copy link

Iskuzer commented Sep 25, 2018

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

@helix46
Copy link

helix46 commented Sep 25, 2018

Work around...
I've had to delete the node_modules folder so often that I've made a script to go in package.json scripts:

"fix-jodit-node-modules": "fix-jodit-node-modules.bat",

Contents of fix-jodit-node-modules.bat (for windows of course):
IF EXIST .\node_modules\jodit-angular\node_modules (
rd .\node_modules\jodit-angular\node_modules /S /q
)

@Raiper34
Copy link

Same problem Angular 6...

@garluk
Copy link

garluk commented Oct 24, 2019

Work around...
I've had to delete the node_modules folder so often that I've made a script to go in package.json scripts:

"fix-jodit-node-modules": "fix-jodit-node-modules.bat",

Contents of fix-jodit-node-modules.bat (for windows of course):
IF EXIST .\node_modules\jodit-angular\node_modules (
rd .\node_modules\jodit-angular\node_modules /S /q
)

This worked to me with Node.js 12.10: https://stackoverflow.com/a/57866165

In your package.json, add:

"scripts": {
    "postinstall": "path_to_your_script"
  }

Then, create a script in your project with the following:

const fs = require('fs');

fs.rmdirSync('node_modules/jodit-angular/node_modules', {recursive: true});

This will run when you npm install, so you don't have to manually delete the folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants