在 Windows 7 上,某些软件包(sqlite3、socket.io)的 npm 安装失败并出现错误 MSB8020
当我在装有 Visual Studio 2012(而不是 2010)的 Windows 7 机器上尝试使用 npm install socket.io
安装一些 node.js 包(特别是 sqlite3 和 socket.io)时,我有一些看起来像这样的失败:
When trying to install some node.js packages (sqlite3 and socket.io in particular) using npm install socket.io
on my Windows 7 machine with Visual Studio 2012 (and not 2010) I had some failures that looked like this:
C:程序文件(x86)MSBuildMicrosoft.Cppv4.0V110Microsoft.Cpp.Platform.targets(35,5):错误 MSB8020:Visual Studio 2010(平台)的构建工具找不到工具集 = 'v100').使用 v100 构建工具,单击项目"菜单或右键单击解决方案,然后然后选择更新 VC++ 项目...".安装 Visual Studio 2010使用 Visual Studio 2010 构建工具构建.
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V110Microsoft.Cpp.Platform.targets(35,5): error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.
推荐答案
为了在我的机器上解决这个问题,我执行了以下命令来安装软件包:
To get around this on my machine I did this command to install the package:
npm install socket.io --msvs_version=2012
我在这里找到了答案,当安装 sqlite3 时遇到问题并且它与 socket.io 一起工作
I found the answer here when having the problem with installing sqlite3 and it worked with socket.io as well.
这些可能是解决问题的更持久的解决方案:
These might be more permanent solutions to fix the problem:
- 安装 Visual Studio 2010
- 按照此处和这里(可能是更好的选择,虽然我没有让它工作但没有尝试太久)
- Install Visual Studio 2010
- Updating the npm internal copy to a newer version of node-gyp as described here and here (probably the better option although I didn't get it working but didn't try for too long)
相关文章