我试着用

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模块

其他回答

我尝试运行以下命令,但PowerShell实例最终挂起/冻结:

npm install -g node-gyp
npm install --global --production windows-build-tools 

因此,我没有在Windows上运行应用程序,而是将应用程序转移到Ubuntu虚拟机实例中,并且能够运行npm install,没有任何问题。

因此,如果上述解决方案都不起作用,并且您不介意在Linux环境中工作,那么可以尝试创建一个Linux虚拟机,并将代码库移植到该虚拟机上。然后运行npm install,看看它是否有效。

这里的问题与npm node-gyp模块有关

我发现该项目在构建页面上提供的解决方案是有效的。

github上的Node-gyp页面

有全自动的和手动的。

正如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 mongoose——msvs_version=2012,如果你安装了多个Visual,它对我有用

我知道这是一个非常古老的问题,但这是我谷歌搜索的第一个问题,一段时间后,我知道如何解决这个问题。

在Windows上查找节点: 正如@janaka-bandara所建议的,你可以使用native 在节点 如果你因为某些原因没有它,你可以用node安装它 $ NPM install -g $哪个节点 CD进入目录后,将CD目录内的目录放入node_modules\npm文件夹,最后: $ NPM install node-gyp@latest 在这里工作,答案来自这个网站