我在Windows工作站上遇到了npm包的一些问题... 我的
package.json
文件中有一组NPM依赖项:
"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" }
当我尝试运行npm install
时,我遇到了与node-gyp
包和类似于\msbuild.exe
的奇怪错误相关的问题。
这是错误信息:
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 )逐个构建此解决方案中的项目。要启用并行构建,请添加“/m”开关。 c:\Users\dmytro.medvid\sites\evolution\node_modules\utf-8-validate\build\validation.vcxproj(20,3):错误 MSB4019:未找到导入的项目“c:\Microsoft.Cpp.Default.props”。确认声明中的路径正确,并且文件存在于磁盘上。 gyp ERR!构建错误 gyp ERR!堆栈错误:`C:\ windows \ Microsoft.NET \ Framework \ v4.0.30319 \ msbuild.exe`退出代码为1 gyp ERR!堆栈位于ChildProcess.onExit(c:\ Program Files \ nodejs \ node_modules \ npm \ node_modules \ node-gyp \ lib \ build.js:270:23) gyp ERR!堆栈emitTwo(events.js:87:13) gyp ERR!堆栈ChildProcess.emit(events.js:172:7) gyp ERR!堆栈在进程.ChildProcess._handle.onexit(internal / child_process.js:200:12)中 gyp ERR!系统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!不行 npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 安装:`node-gyp rebuild` npm WARN install:utf-8-validate@1.2.1 退出状态1 npm WARN EPACKAGEJSON evolution@1.0.0 没有存储库字段。
能有人帮忙解决这个问题吗?我不是经验丰富的Windows用户,但现在我必须使用Windows:(
更新: 这里是错误日志,我会随时更新其中的NPM错误。
系统详细信息: Windows 7企业版64位操作系统
Node版本: v5.1.0
NPM版本: v3.3.12
Python版本: v2.7.1
此外,我还安装了Microsoft Visual C++构建工具(提供在下面的答案中)。版本14.0