[英]npm Err : gyp Err npm ERR! inotify@1.4.6 install: `node-gyp rebuild`
[英]node-gyp err on install for npm integer
節點版本:節點:v11.10.0 和 npm:6.7.0
平台:Windows 10
模塊:整數
每次嘗試安裝整數時,都會出現以下錯誤。
PS C:\Users\will_\OneDrive\Desktop\bot-test> npm i integer
> integer@2.1.0 install C:\Users\will_\OneDrive\Desktop\bot-test\node_modules\integer
> node-gyp rebuild
C:\Users\will_\OneDrive\Desktop\bot-test\node_modules\integer>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe ENOENT
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
gyp ERR! stack at onErrorNT (internal/child_process.js:427:16)
gyp ERR! stack at processTicksAndRejections (internal/process/next_tick.js:76:17)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\will_\OneDrive\Desktop\bot-test\node_modules\integer
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR! <https://github.com/nodejs/node-gyp/issues>
npm WARN discord.js@11.4.2 requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js@11.4.2 requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN bot-test@1.0.0 No repository field.
npm WARN bot-test@1.0.0 license should be a valid SPDX license expression
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! integer@2.1.0 install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the integer@2.1.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\will_\AppData\Roaming\npm-cache\_logs\2019-02-28T07_57_21_798Z-debug.log
我在谷歌上查找了錯誤並得到了不同的結果。 我嘗試了不同的方法,從重新安裝 Microsoft Visual Studio 到編輯注冊表中的文件。 我已經嘗試了很多東西,並在其他論壇上尋求幫助。 我似乎無法自己解決這個問題,並且會很感激一些。
我建議你安裝 node.js 的構建工具。 這些將幫助您編譯 node-gyp 包,並且很可能會修復您的錯誤。 只需以管理員身份啟動 PowerShell 並運行:
npm install --global windows-build-tools
或者,如果您使用的是 Yarn:
yarn global add windows-build-tools
NPM 包: windows-build-tools
您也可以手動安裝
Python 2.7
和Visual C++ Build Tools
,但 windows-build-tools 會為您處理這一切!
我在切換計算機時遇到了類似的異常。 我只是刪除了package-lock.json
,然后它就起作用了。
在堅持這些錯誤很多小時之后,我終於想通了。 永遠記住仔細查看以以下開頭的錯誤:
吉普錯誤! 堆棧錯誤:生成 C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe ENOENT
這意味着Microsoft Visual Studio 的路徑是錯誤的(可以通過在資源管理器地址欄中粘貼C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\MSBuild\\15.0\\Bin\\MSBuild.exe 來檢查),所以糾正只是使用:
set path=%path%;C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Current\Bin
糾正錯誤。
嘗試將 node-gyp 安裝為 Global。
npm install -g node-gyp
並且您還需要在系統中安裝構建工具,要安裝構建工具,請在終端中執行此說明。
npm install build-tools -g
這應該可以解決您的問題,如果尚未解決,請嘗試重新啟動。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.