仅安装了 Visual Studio 2013 的 NPM 本机构建 [英] NPM native builds with only Visual Studio 2013 installed

查看:85
本文介绍了仅安装了 Visual Studio 2013 的 NPM 本机构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经全新安装了 Windows,安装了 Visual Studio 2013 Pro,以及当前版本的 Python、node 和 npm.

I've got a clean install of Windows with Visual Studio 2013 Pro installed, along with current versions of Python, node and npm.

我正在尝试安装 pg npm 包,但它需要本地构建并且失败了:

I'm trying to install the pg npm package, but it requires a native build and is failing:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5):错误 MSB8020:Visual Studio 2012(平台)的构建工具找不到工具集 = 'v110').使用 v110 构建工具,请安装 Visual Studio 2012 构建工具.或者,您可以通过选择升级到当前的 Visual Studio 工具项目菜单或右侧- 单击解决方案,然后选择升级解决方案...".[C:\Users\Aaron\AppData\Roaming\npm\node_modules\pg\build\binding.vcxproj]

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2012 (Platform Toolset = 'v110') cannot be found. To build using the v110 build tools, please install Visual Studio 2012 build tools. Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right -click the solution, and then selecting "Upgrade Solution...". [C:\Users\Aaron\AppData\Roaming\npm\node_modules\pg\build\binding.vcxproj]

我似乎找不到所描述的 Visual Studio 2012 构建工具,而且我当然更喜欢不需要安装 VS2012 来满足这一需求.有没有办法强制安装和构建使用可用的 2013 编译器/工具,而不更改包的代码?

I can't seem to find Build tools for Visual Studio 2012 as described, and I'd certainly prefer to not need to install VS2012 just for this one need. Is there a way to force the install and build to use the available 2013 compiler/tools, without changing the code of the package?

我找不到任何人使用我的 Googlefu 描述这个具体问题和解决方案.

I couldn't find anyone describing this specific problem and a solution using my Googlefu.

推荐答案

我只使用 Visual Studio 2013 安装了 Windows 8.1(64 位)专业版(没有以前版本的 VS,尽管 SQL Server 2014 附带了一些组件).npm install 命令失败并出现类似错误.

I have too clean install of Windows 8.1 (64bit) Pro with Visual Studio 2013 only (no previous version of VS, although some components came with SQL Server 2014). The npm install command failed with similar error.

所以我尝试指定 VS 版本

So I tried to specify VS version

npm install --msvs_version=2013 <package>

它使用平台工具集v120"正确启动,但构建失败并出现以下错误(注意目标路径中使用的 V110):

It started correctly using Platform Toolset 'v120' but the build failed with the following error (note the V110 used in the path for targets):

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform找不到工具集 = 'v120').要使用 v120 构建工具进行构建,请单击项目"菜单或右键单击解决方案,然后选择更新 VC++ 项目...".安装 v120 以使用 v120 构建工具进行构建.

我转到路径 c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\ 并找到两个子文件夹:V110 和 <代码>V120.

I went to the path c:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\ and found there two subfolders: V110 and V120.

为了更正用于目标的路径,我必须像这样设置环境变量:

To correct the path used for targets I had to set environment variable like this:

set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120

然后安装包.

供参考,版本:
VS 2013 高级版
Python 2.7.8
C:\Windows\system32>npm 版本{ http_parser: '1.0',节点:'0.10.29',v8: '3.14.5.9',战神:'1.9.0-DEV',紫外线:'0.10.27',zlib: '1.2.3',模块:'11',openssl: '1.0.1h',npm: '1.4.14' }

这篇关于仅安装了 Visual Studio 2013 的 NPM 本机构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆