npm 在 windows 上安装 windows-build-tools

Posted

技术标签:

【中文标题】npm 在 windows 上安装 windows-build-tools【英文标题】:npm install windows-build-tools on windows 【发布时间】:2022-01-03 16:04:17 【问题描述】:
OS - Windows-10
node - v8.12.0
npm - 6.4.1

我正在使用的命令(以管理员身份运行):

npm install --global --production --verbose windows-build-tools
> windows-build-tools@5.2.2 postinstall C:\Users\winuser\AppData\Roaming\npm\node_modules\windows-build-tools
> node ./dist/index.js

Downloading vs_BuildTools.exe
[============================================>] 100.0% of 1.12 MB (1.12 MB/s)
Downloaded vs_BuildTools.exe. Saved to C:\Users\winuser\.windows-build-tools\vs_BuildTools.exe.

Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
2021-11-23T15:34:08 : Verbose : [InstalledProductsProviderImpl]: Stream was closed
2021-11-23T15:34:08 : Verbose : [InstallerImpl]: Rpc connection was closed.
2021-11-23T15:34:08 : Verbose : [InstallerImpl]: Stream was closed
2021-11-23T15:34:09 : Verbose : Completed notifying all clients that the update is starting
2021-11-23T15:34:09 : Verbose : Updating installer [bootstrapperArguments: -- /finalizeInstall install --in C:\ProgramData\Microsoft\VisualStudio\Packages\_bootstrapper\vs_setup_bootstrapper_202111231533560643.json --norestart --quiet --includeRecommended --add Microsoft.VisualStudio.Workload.VCTools --locale en-US --activityId 61b330e5-53cf-4d1e-819c-b2acdd48ed03]
------------------- Python --------------------
Python 2.7.18 is already installed, not installing again.

它没有出来,已经尝试安装几次。在这两种情况下,它看起来都卡在同一点上。

尝试了以下命令,它已安装但显示Could not install Visual Studio Build Tools.

npm install --global --production windows-build-tools@4.0.0
Starting installation...
Launched installers, now waiting for them to finish.
This will likely take some time - please be patient!

Status from the installers:
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
---------- Visual Studio Build Tools ----------
Successfully installed Visual Studio Build Tools.
------------------- Python --------------------
Python 2.7.18 is already installed, not installing again.

Could not install Visual Studio Build Tools.
Please find more details in the log files, which can be found at
C:\Users\winuser\.windows-build-tools

谁能帮帮我?

【问题讨论】:

【参考方案1】:

您应该手动安装visual studio,并在安装过程中选择.NET 和C/C++ 组件。我遇到了同样的问题,这对我来说很有效。

【讨论】:

以上是关于npm 在 windows 上安装 windows-build-tools的主要内容,如果未能解决你的问题,请参考以下文章

无法在 Windows 10 上 npm 安装 web3

Windows上的全局npm安装位置?

Windows 上的 Jhipster uml 安装问题:NPM 在 msbuild.exe 上失败,退出代码为 1

如何在 Windows 10 上安装 nodemon?

如何在 Windows 上更新 npm?

尝试在 Windows 上安装 NPM 包时遇到证书错误。我正在使用节点 v10.9.0