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 thedeclaration 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:[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
I created an issue on stackoverflow, but at the moment it have no any solution: http://stackoverflow.com/questions/34335043/troubles-with-npm-and-node-gyp-in-windows
Probably a variation on https://github.com/nodejs/node-gyp/issues/779. A solution is discussed in the comments.
Can you check your registry settings?
Run the following command:
reg query HKLM\Software\Microsoft\MSBuild /s
Its should be similar to https://gist.github.com/saper/124a63c38bffb0a38d9b
Not sure but all those MS Build stuff only seems to partially work. I had the same troubles and tried various ways to fix all node-gype issue. On fix was to install Visual Studio completely. Solve a lot of problems but if you not need it than it is just wasted space.
What actually helped me was to install the Visual C++ Redistribution Package. I installed the lated 64 bit Version on my system. After that all issues was magically gone.
Instead installing just the build tools the Redistribution components include a full runtime environment under windows and not only to build things. Hope this helps for you too.
I'll go ahead and assume it's working now. Closing.
npm install --global --production windows-build-tools is what worked for me.
I was also facing the same issue, how about npm install --global windows-build-tools ? windows-build-tools already take care of python installation and build tools. This worked for me. Run the command as Administrator.
If you have VS2017 installed
From PowerShell :
[Environment]::SetEnvironmentVariable("VCTargetsPath", "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\", "Machine")
@EbramTawfik
Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed."
At line:1 char:1
@hussain992 This is clearly a problem with permissions on your system. You can remove the "Machine" argument or try "User" instead.
@hussain992 Did you try to run as administrator?
Ya I tried as Administrator, then I downloaded .exe file and problem got
resolved
On Mon, Sep 30, 2019, 2:22 AM Ebram Tawfik notifications@github.com wrote:
@hussain992 https://github.com/hussain992 Did you try to run as
administrator?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node-gyp/issues/849?email_source=notifications&email_token=ADUI6GQOZVNQTADJT5AOBHLQMEISXA5CNFSM4BXT445KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD736M4I#issuecomment-536340081,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ADUI6GW2XNCOIOC6GE5Q3RDQMEISXANCNFSM4BXT445A
.
(I think this can be closed, thanks)
Most helpful comment
npm install --global --production windows-build-toolsis what worked for me.