node.js - 尝试安装 Windows 构建工具时出错
问题描述
当我npm run windows-intall
又跑
npm install -g --production windows-build-tools && npm install --production
我收到以下错误。我已经安装了 python 3.8.2,安装了 Node v14.0.0 x64,Powershell 添加到了路径 [在环境变量、用户变量/系统变量、PATH 中]。从 VScommunity 下载的 Windows 构建工具。我也下载了 Windows dev 通用选项。(尚未重新启动 PC)
这是我得到的错误:
node ./dist/index.js Downloading python-2.7.15.amd64.msi [> ] 0.0% (0 B/s) Downloaded python-2.7.15.amd64.msi. Saved to C:\Users\tariq\.windows-build-tools\python- 2.7.15.amd64.msi. Downloading vs_BuildTools.exe [> ] 0.0% (0 B/s) Downloaded vs_BuildTools.exe. Saved to C:\Users\tariq\.windows-build-tools\vs_BuildTools.exe. Starting installation... events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn powershell.exe ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:268:19) at onErrorNT (internal/child_process.js:468:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:274:12) at onErrorNT (internal/child_process.js:468:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: -4058, code: 'ENOENT', syscall: 'spawn powershell.exe', path: 'powershell.exe', spawnargs: [ '-ExecutionPolicy', 'Bypass', '-NoProfile', '-NoLogo', "& {& 'C:\\Users\\tariq\\AppData\\Roaming\\npm\\node_modules\\windows-build-tools\\ps1\\launch-installer.ps1' -BuildToolsInstallerPath 'C:\\Users\\tariq\\.windows-build-tools' -InstallBuildTools -ExtraBuildToolsParameters '' -PythonInstaller 'python-2.7.15.amd64.msi' -InstallPython -VisualStudioVersion '2017' }" ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! windows-build-tools@5.2.2 postinstall: `node ./dist/index.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the windows-build-tools@5.2.2 postinstall 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\tariq\AppData\Roaming\npm-cache\_logs\2020-06-05T04_48_32_980Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! gawesomebot@5.0.0 windows-install: `npm install -g --production windows-build-tools && npm install --production` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the gawesomebot@5.0.0 windows-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\tariq\AppData\Roaming\npm-cache\_logs\2020-06-05T04_48_33_077Z-debug.log
解决方案
command-line
以管理员身份运行并尝试以下操作:
npm install --global windows-build-tools@4.0.0
推荐阅读
- google-cloud-dataflow - JdbcIO.Write.withResults 和 Wait.on 具有无界 PCollection 和 FixedWindow
- java - 运行 jar 文件返回错误:错误:无法找到或加载主类 MyClass 原因:java.lang.ClassNotFoundException:MyClass
- javascript - 使用 ReactJS / Typescript / Socket.io 同步视频时出现问题
- python - 绑定kivy的问题
- google-admin-sdk - 我需要能够从 Google 转销商控制台的转销商结算部分下载月度帐单
- java - 从对象的特定属性中组合多个值
- r - 在shinydashboardPlus()中将动态图片url链接传递给UI不起作用
- express - 使用 type-graphql typeorm 和 dataloader 处理一对多的最佳方法
- java - 我想巧妙地使用 for 循环打印一维数组。(爪哇)
- mysql - 如何在 XAMPP 中更改 max_connections_per_hour?