[英]Node 10 - `node-gyp rebuild` error during npm install
我最近升級到 Node 10,當我運行npm install
時出現以下錯誤:
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.
在“macOS Mojave”上工作時,我使用 Node10 在同一個項目上工作,沒有任何問題。 請告知可能導致錯誤的原因是什么?
通過將 npm 更新到最新版本並運行 npm rebuild 解決了該問題。
使用NVM
管理節點。 這真的很有幫助。 我有同樣的錯誤,但通過使用最新的Node LTS版本解決了它。 這可以通過單個命令使用 NVM 輕松完成。
nvm install --lts
在不知道實際的 node-gyp 錯誤的情況下,請確保您已經為您的平台安裝了node-gyp 依賴項。
我認為刪除這個目錄更好:
rm -rf ~/.node-gyp/
rm -r node_modules/.bin/;
rm -r build/
你可以測試
npm install -g node-gyp
和
npm install -g node-pre-gyp
最后:
npm install <your module>
我遇到了同樣的問題,通過刪除 yarn.lock文件然后再次運行yarn install
解決了這個問題
我有同樣的問題。 首先我刪除了 package.json 並運行 npm install 但它沒有幫助。 只有返回到以前的穩定節點版本才對我有所幫助。 (nvm 非常有用)
我推薦以下內容:
刪除 node_modules 文件夾
npm install --force
npm update -g npm --force
如果在 Windows 上: npm -g install --production windows-build-tools
運行 node.js 文件
來源GitHub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.