节点版本:节点: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
我在Google上查找了错误,并得到了不同的结果。从重新安装Microsoft Visual Studio到在注册表中编辑文件,我尝试了不同的方法。我尝试了很多事情,并在其他论坛上寻求帮助。我似乎无法自己解决这个问题,并且会很感激。
答案 0 :(得分:2)
切换计算机时,我也遇到类似的异常。我只是删除了package-lock.json
,然后它起作用了。
答案 1 :(得分:1)
我建议您为节点安装构建工具。 这些将帮助您编译node-gyp软件包,最有可能修复您的错误。 只需以管理员身份启动PowerShell并运行:
0|echo-ser | ⚠ Starting server in DEV mode...
0|echo-ser |
0|echo-ser | ✔ Running at localhost on port 6001
0|echo-ser | ✔ Channels are ready.
0|echo-ser | ✔ Listening for http events...
0|echo-ser |
0|echo-ser | L A R A V E L E C H O S E R V E R
0|echo-ser |
0|echo-ser | version 1.5.0
0|echo-ser |
0|echo-ser | ⚠ Starting server in DEV mode...
0|echo-ser |
0|echo-ser | ✔ Running at localhost on port 6001
0|echo-ser | ✔ Channels are ready.
0|echo-ser | ✔ Listening for http events...
/root/.pm2/logs/echo-server-error.log last 15 lines:
0|echo-ser | at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
0|echo-ser | [ioredis] Unhandled error event: Error: connect ECONNREFUSED 127.0.0.1:6379
或者,如果您使用的是纱线:
npm install --global windows-build-tools
NPM软件包:windows-build-tools
您还可以手动安装
yarn global add windows-build-tools
和Python 2.7
,但Windows-build-tools会为您完成所有这些工作!
答案 2 :(得分:0)
在这些错误上坚持了好几个小时后,我终于想通了。永远记住仔细查看以以下开头的错误:
gyp 错误!堆栈错误:生成 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
纠正错误。
答案 3 :(得分:-1)
尝试将node-gyp安装为全局。
npm install -g node-gyp
并且您还需要在系统中安装构建工具,要安装构建工具,请在终端上执行此说明。
npm install build-tools -g
这应该可以解决您的问题,如果尚未解决,请尝试重新启动。