我试着用

npm install steam

但是我得到一个错误说

我不确定如何解决这个问题,我已经在两个不同的npm模块安装上得到了这个。不过,我可以安装其他模块。

我的尝试: 安装任何需要的依赖项。(大熊座、node-gyp等) 安装Visual c++ 2005。 安装Visual c++ 2010。 将环境变量路径更改为/VC/(在另一个StackOverflow线程/问题上找到)。 谷歌,谷歌,谷歌。

我也得到一个错误尝试做:

npm install ursa

错误是:


当前回答

正如Matt所说(https://stackoverflow.com/a/43323045/2767413),你应该为windows安装构建工具。 然而,我通过cmd并得到了一个错误,尽管我是管理员-

Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".

我通过PowerShell得到了同样的错误。

对于windows7,管理PowerShell可以在下面找到:

控制面板->系统和安全->管理工具-> Windows PowerShell模块

其他回答

对于上述答案不适用的人,这里有另一种可能的解决方案。

问题: 在安装npm os-service包时,我得到了以下错误 导入的项目"d:\M microsoft . cppp . default . exe "“道具”没有找到。确认声明中的路径是正确的

甚至构建工具或VS 2015的安装对我来说都不起作用。所以我尝试直接通过PowerShell(以管理员身份)安装下面的程序

https://chocolatey.org/packages/visualcpp-build-tools/14.0.25420.1 命令: 安装visualcppp -build-tools -version 14.0.25420.1

安装完成后,设置一个环境变量 VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140

在这些之后,包的安装工作非常顺利。

只是为了补充上面的答案,任何人发现安装程序的问题都很长,我发现我的问题是python,我卸载了我的版本3和版本2。

以管理员身份在PowerShell终端重新运行该命令,几乎马上就安装好了。

npm install --global --production windows-build-tools 

我尝试了上面建议的npm install -global -production windows-build-tools,但发现安装总是永远挂起。

我设法通过安装Node.js 8而不是Node.js 10来解决这个问题。

正如Matt所说(https://stackoverflow.com/a/43323045/2767413),你应该为windows安装构建工具。 然而,我通过cmd并得到了一个错误,尽管我是管理员-

Please restart this script from an administrative PowerShell!
The build tools cannot be installed without administrative rights.
To fix, right-click on PowerShell and run "as Administrator".

我通过PowerShell得到了同样的错误。

对于windows7,管理PowerShell可以在下面找到:

控制面板->系统和安全->管理工具-> Windows PowerShell模块

NPM install——global windows-build-tools

只需通过powershell运行此命令(右键单击并以管理员身份运行!)

为我工作过…