Windows中的NPM和node-gyp出现问题 [英] Troubles with NPM and node-gyp in Windows

查看:6315
本文介绍了Windows中的NPM和node-gyp出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Windows工作站上的npm包有一些麻烦......我在 package.json file:

devDependencies:{
babel-plugin-transform-react-jsx:^ 6.2.0,
babel-preset-es2015:^ 6.1 .18,
babel-preset-react:^ 6.1.18,
grunt:^ 0.4.5,
grunt-babel:^
grunt-contrib-connect:^ 0.11.2,
grunt-contrib-jasmine:^ 0.9.2,
grunt- contrib-sass:^ 0.9.2,
grunt-contrib-watch:^ 0.6.1,
grunt-exec:^ 0.4.6,
grunt-template-jasmine-requirejs:^ 0.2.3,
karma-chrome-launcher:^ 0.2.2,
karma-firefox-launcher: ^ 0.1.7,
karma-requirejs:^ 0.2.2,
requirejs:^ 2.1.22,
grunt-contrib-jshint :^ 0.11.3,
grunt-karma:^ 0.12.1 ,
karma:^ 0.13.15,
karma-jasmine:^ 0.3.6,
karma-phantomjs-launcher:^ 0.2.1

当我尝试运行 npm install I获得与 node-gyp 包有关的奇怪错误,以及类似于 \msbuild.exe

的奇怪错误

这是错误:

 
c:\Users\dmytro.medvid\sites\\ \\ evolve \ node_modules \ utf-8-validate>如果没有定义npm_config_node_gyp(nodec:\ Program Files \ node \ s \ node_modules \\\\\\\\\\\\\\\' \\\\\\\
ode_modules\\\
ode-gyp\bin\\\
ode-gyp.jsrebuild)else(node rebuild)
一次构建一个解决方案中的项目。要启用并行构建,请添加/ m开关。
c:\ Users \ dmytro.medvid\sites\evolution\\\
ode_modules\utf-8-validate\build\validation.vcxproj(20,3):错误MSB4019:导入的项目 c:\Microsoft.Cpp.Default。
道具未找到。确认声明中的路径是正确的,并且该文件存在于磁盘上。
gyp ERR!构建错误
gyp ERR!堆栈错误:`C:\windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe`因退出代码失败:1
gyp ERR!在ChildProcess.onExit(c:\Program Files\\\
odejs\\\
ode_modules\\\
pm\\\
ode_modules\\\
ode-gyp\lib\build.js:270:23)处添加堆栈
gyp ERR!在emitTwo堆栈(events.js:87:13)
gyp ERR!堆栈在ChildProcess.emit(events.js:172:7)
gyp ERR!堆栈在Process.ChildProcess._handle.onexit(internal / child_process.js:200:12)
gyp ERR!系统Windows_NT 6.1.7601
gyp ERR!命令c:\\Program Files\\\\\\\\\\节点文件\\\\节点文件\\\\\\\\\\\节点文件\\\节点\\\ \\ \\ node_modules \\\\
ode-gyp \\\\\\\\\\\ node-gyp.jsrebuild
gyp ERR! cwd c:\ Users \dmytro.medvid\sites\evolution\\\
ode_modules\utf-8- validate
gyp ERR! node -v v5.1.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR!不行
npm WARN安装:utf-8-validate@1.2.1 utf-8-validate@1.2.1安装:`node-gyp rebuild`
npm WARN安装:utf-8-validate @ 1.2.1退出状态1
npm WARN EPACKAGEJSON evolution@1.0.0没有存储库字段。

有人可以帮助解决问题吗?我没有经验的Windows用户,但目前我应该使用Windows:(b / b
$ b

更新:这里是错误日志,我每次更新新的NPM错误。 / p>

系统详情: Windows 7 Enterprice 64位操作系统

节点版本: v5.1.0



NPM版本: v3.3.12 b
$ b

Python版本: v2.7.1



我还安装了 Microsoft Visual C ++编译工具(在下面的答案中提供)版本14.0 >解决方案

您需要Microsoft Visual C ++构建工具,这些工具与Visual Studio一起打包,但现在也可以作为独立下载。安装这些工具并重新启动计算机后,您应该能够安装使用node-gyp的软件包。


I have some troubles with npm packages on my Windows workstation... I have a set of NPM dependencies in my package.json file:

"devDependencies": {
    "babel-plugin-transform-react-jsx": "^6.2.0",
    "babel-preset-es2015": "^6.1.18",
    "babel-preset-react": "^6.1.18",
    "grunt": "^0.4.5",
    "grunt-babel": "^6.0.0",
    "grunt-contrib-connect": "^0.11.2",
    "grunt-contrib-jasmine": "^0.9.2",
    "grunt-contrib-sass": "^0.9.2",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-exec": "^0.4.6",
    "grunt-template-jasmine-requirejs": "^0.2.3",
    "karma-chrome-launcher": "^0.2.2",
    "karma-firefox-launcher": "^0.1.7",
    "karma-requirejs": "^0.2.2",
    "requirejs": "^2.1.22",
    "grunt-contrib-jshint": "^0.11.3",
    "grunt-karma": "^0.12.1",
    "karma": "^0.13.15",
    "karma-jasmine": "^0.3.6",
    "karma-phantomjs-launcher": "^0.2.1"
  }

And when I trying to run npm install I get the strange error related to node-gyp package and something like \msbuild.exe.

Here is the error:

c:\Users\dmytro.medvid\sites\evolution\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "c:\Program Files\nodejs\node_modules\npm\bin\node-gyp
-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
c:\Users\dmytro.medvid\sites\evolution\node_modules\utf-8-validate\build\validation.vcxproj(20,3): error MSB4019: The imported project "c:\Microsoft.Cpp.Default.
props" was not found. Confirm that the path in the  declaration is correct, and that the file exists on disk.
gyp ERR! build error
gyp ERR! stack Error: `C:\windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\Users\dmytro.medvid\sites\evolution\node_modules\utf-8-validate
gyp ERR! node -v v5.1.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
npm WARN EPACKAGEJSON evolution@1.0.0 No repository field.

Can someone help to figure out with it issue? I'm not experienced windows user, but at the moment I should work with Windows :(

UPDATED: Here is the errors log which I update every time with new NPM errors.

System details: Windows 7 Enterprice 64-bit operating system

Node version: v5.1.0

NPM version: v3.3.12

Python Version: v2.7.1

Also I installed Microsoft Visual C++ build tools (provided in answer below). Version 14.0

解决方案

You need Microsoft Visual C++ build tools, which are packaged with Visual Studio. However, they are now also available as a standalone download. After installing these tools and restarting your computer, you should be able to install packages that use node-gyp under the hood.

这篇关于Windows中的NPM和node-gyp出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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