Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
924 views
in Technique[技术] by (71.8m points)

node.js - Troubles with NPM and node-gyp in Windows

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:Usersdmytro.medvidsitesevolution
ode_modulesutf-8-validate>if not defined npm_config_node_gyp (node "c:Program Files
odejs
ode_modules
pmin
ode-gyp
-bin\....
ode_modules
ode-gypin
ode-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:Usersdmytro.medvidsitesevolution
ode_modulesutf-8-validateuildvalidation.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:windowsMicrosoft.NETFrameworkv4.0.30319msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:Program Files
odejs
ode_modules
pm
ode_modules
ode-gyplibuild.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:Usersdmytro.medvidsitesevolution
ode_modulesutf-8-validate
gyp ERR! node -v v5.1.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
npm WARN EPACKAGEJSON [email protected] 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Write those code in admin command prompt:

npm install --global --production windows-build-tools

And then hit enter.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...