第一次尝试c++扩展,但是在node-gyp build 时失败 ,求是什么原因呀
发布于 7 年前 作者 heguangda 4288 次浏览 来自 问答

X2(XOBRGPEHIJ6M70HK84B4.png

4 回复

Windows要装visual studio全家桶或windows-build-tools,并且还要在npm里面设置全家桶版本 https://www.visualstudio.com/zh-hans/vs/support/

当然我建议你用Linux玩这个,这样最简单。装东西基本yum或apt-get或brew都能搞定

node-gyp的介绍里也简单的写了 On Windows

Option 1

Install all the required tools and configurations using Microsoft’s windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

Option 2

Install tools and configuration manually:

Visual C++ Build Environment:

Option 1: Install Visual C++ Build Tools using the Default Install option.

Option 2: Install Visual Studio 2015 and select Common Tools for Visual C++ during setup. This also works with the free Community and Express for Desktop editions.

Option 3: if you already have Visual Studio 2015 installed and did not install the Common Tools for Visual C++ during setup, you can File -> New -> Project, pick any of the options under Templates -> Other Languages -> Visual C++ then Ok and Visual Studio will offer to install the Common Tools for Visual C++ with a “Install Missing Features” / “You need the Universal Windows App Development Tools to develop Windows app projects.” dialog.

💡 [Windows Vista / 7 only] requires .NET Framework 4.5.1 Install Python 2.7 (v3.x.x is not supported), and run npm config set python python2.7 (or see below for further instructions on specifying the proper Python version and path.)

Launch cmd, npm config set msvs_version 2015

来自酷炫的 CNodeMD

上面的问题解决了 原因是没有安装.net4.5; 但是又有新的问题出现1.png2.png 这个vctargetpath是什么东西来的

有几种解决方案: 1,全局安装npm-gyp 2, 好像安装什么C++(linux上)

.net一般win7以上版本都自带了

回到顶部