Node 10 - `node-gyp rebuild` error during npm install
28,557
Solution 1
Resolved the issue by updating npm to latest version & running npm rebuild.
Solution 2
Use NVM
for managing node. It is really helpful. I had the same error but solved it by using the latest Node LTS version. That can be done with NVM easily by a single command.
nvm install --lts
Solution 3
without knowing the actual node-gyp error, make sure you've installed the node-gyp dependencies for your platform.
Solution 4
I think delete this directory is better:
rm -rf ~/.node-gyp/
rm -r node_modules/.bin/;
rm -r build/
and you can test
npm install -g node-gyp
and
npm install -g node-pre-gyp
finally:
npm install <your module>
Author by
David Faizulaev
Updated on April 24, 2021Comments
-
David Faizulaev about 3 years
I've recently upgraded to Node 10 and when I run
npm install
I get the following error:make: *** [Release/obj.target/memwatch/src/init.o] Error 1 gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23) gyp ERR! stack at ChildProcess.emit (events.js:182:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12) gyp ERR! System Darwin 18.2.0 gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /Users/david/Documents/gitlab/project/node_modules/memwatch-next gyp ERR! node -v v10.15.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Working on 'macOS Mojave', I worked on the same project with Node10 without any issues. Please advise what can be causing the error?
-
David Faizulaev over 5 yearsAdded more info, also ran
npm install -g node-gyp
then rannpm install
got the same error. -
Ran Ever-Hadani over 5 yearsI am having the same problem, also osx mojave. Also ran npm install -g node-gyp, also got the same error.