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! memwatch-next@0.3.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the memwatch-next@0.3.0 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?
通过将 npm 更新到最新版本并运行 npm rebuild 解决了该问题。
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
在不知道实际的 node-gyp 错误的情况下,请确保您已经为您的平台安装了node-gyp 依赖项。
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>
我遇到了同样的问题,通过删除 yarn.lock文件然后再次运行yarn install
解决了这个问题
I had the same problem. First I removed package.json and run npm install but it doesn't help. Only a return to the previous stable node version helped me. (nvm is very useful)
I recommend the following:
remove node_modules folder
npm install --force
npm update -g npm --force
If on Windows: npm -g install --production windows-build-tools
run node.js file
Source GitHub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.