提问人:Vinicius Leite 提问时间:11/14/2023 最后编辑:Vinicius Leite 更新时间:11/15/2023 访问量:106
NPM 错误!1 NPM 错误!安装软件包时
NPM Err! 1 NPM ERR! When installing package
问:
当我尝试安装软件包“node-red-node-arduino”时,我收到此错误。以下是完整日志:
PS C:\Users\User\.node-red> npm i --unsafe-perm node-red-node-arduino
npm ERR! code 1
npm ERR! path C:\Users\User\.node-red\node_modules\@serialport\bindings
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:380:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2015 (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:364:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:67:12
npm ERR! gyp ERR! stack at failPowershell (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:156:7)
npm ERR! gyp ERR! stack at VisualStudioFinder.parseData (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:170:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:143:14
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:414:7)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\nvm\\v20.9.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\User\.node-red\node_modules\@serialport\bindings
npm ERR! gyp ERR! node -v v20.9.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2023-11-14T13_20_45_527Z-debug-0.log
我已经通过 NVM 安装了 node 和 NPM,通过命令“nvm install 20.9.0”,20.9.0 是他们所说的节点的最后一个稳定版本。
编辑1: 安装了 VS Code 并重新启动了计算机,但仍然得到这个结果:
PS C:\Users\User\.node-red> npm i -g --unsafe-perm node-red-node-arduino
npm ERR! code 1
npm ERR! path C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\node-red-node-arduino\node_modules\@serialport\bindings
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install --tag-prefix @serialport/bindings@ || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.12.0 found at "C:\Users\User\AppData\Local\Programs\Python\Python312\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS not looking for VS2015 as it is only supported up to Node.js 18
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:75:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:380:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:71:14
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2015 (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:364:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:67:12
npm ERR! gyp ERR! stack at failPowershell (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:156:7)
npm ERR! gyp ERR! stack at VisualStudioFinder.parseData (C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:170:14)
npm ERR! gyp ERR! stack at C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:143:14
npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:414:7)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\User\\AppData\\Roaming\\nvm\\v20.9.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\User\AppData\Roaming\nvm\v20.9.0\node_modules\node-red-node-arduino\node_modules\@serialport\bindings
npm ERR! gyp ERR! node -v v20.9.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in: C:\Users\User\AppData\Local\npm-cache\_logs\2023-11-14T16_45_22_153Z-debug-0.log
答:
评论