1

When I run npm install on my project, I get

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: .....@10.1.3
npm ERR! Found: @angular/forms@11.2.14
npm ERR! node_modules/@angular/forms
npm ERR!   @angular/forms@"^11.2.14" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/forms@"^12.0.0" from ngx-typesafe-forms@1.5.1
npm ERR! node_modules/ngx-typesafe-forms
npm ERR!   ngx-typesafe-forms@"^1.4.3" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/..../.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2021-09-02T10_06_13_858Z-debug.log

then I tried I have tried running npm install --legacy-peer-deps and got

npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/......./node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/16.4.2/bin/node" "/Users/...../node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/......../node_modules/node-sass
npm ERR! gyp ERR! node -v v16.4.2
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

i have tried deleting my node_modules folder and running it again.

npm -v = 7.21.1

solar apricot
  • 353
  • 2
  • 5
  • 24
  • Have you tried `npm cache clean --force`? – Giovanni Esposito Sep 02 '21 at 09:34
  • yes, i have :( unfortunately i still get the same problem – solar apricot Sep 02 '21 at 09:46
  • Similar to open [Issue #2458](https://github.com/nodejs/node-gyp/issues/2458) in the `node-gyp` repo. – RobC Sep 02 '21 at 09:57
  • I found [this](https://github.com/nodejs/node-gyp/issues/1779). There are several workaround you could try (installing node using nvm, cancel package.json and re-run npm install...). Let me know if you solved. – Giovanni Esposito Sep 02 '21 at 09:58
  • Perhaps try [updating the npm-bundled version of node-gyp](https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md) – RobC Sep 02 '21 at 10:05
  • @RobC i tried following the steps described in https://github.com/nodejs/node-gyp/blob/master/docs/Updating-npm-bundled-node-gyp.md but it seems to be picking up the 3.8 version still.. (npm config set node_gyp $(npm prefix -g)/lib/node_modules/node-gyp/bin/node-gyp.js) have you done this before and had success? – solar apricot Sep 02 '21 at 13:34
  • Hi @solarapricot - No, I haven't had the need to do this before. If you now run `npm config get node_gyp`, what does it return? – RobC Sep 02 '21 at 14:10
  • @RobC it returns /opt/homebrew/lib/node_modules/node-gyp/bin/node-gyp.js – solar apricot Sep 02 '21 at 15:11
  • Anything worked out? – Janos Vinceller Dec 11 '21 at 10:27
  • For me, installing node-gyp brings another error: no member named 'GetContents' in 'v8::ArrayBuffer' - gonna try this one now: https://stackoverflow.com/questions/69290893/getcontents-in-v8arraybuffer – Janos Vinceller Dec 11 '21 at 10:41
  • I was running on nvm, I changed npm versions from 16.x.x to 14.x.x and the install worked! – Monty Dec 14 '21 at 23:03

1 Answers1

3

I got same issue, my angular project version was 9 and the node version was 16 and npm version was 8. just downgrade your node version and then run npm install it worked for me. use the same node version that the package-lock.json file was created for the first time. hope this is helpful

Oveis
  • 93
  • 6