Windows users are not happy.
It all started with this conversation.
As I said, I'm pretty much a newbie and I don't even know what node-gyp does, but what I DO know is that it's a pain to run Windows and install a project with node-gyp as a dependency. Some numbers:
It's bizarre that a nodejs developer needs to install visual studio (even the express edition) in order to be able to work on Windows. Even more bizarre is that I, as a .NET developer with full visual studio installed in my machine still can't download a bunch of projects that use this project.
With that being said, I'd like to know from all of you what should we do to make windows users fall in the pit of success? What are the alternatives? Does Microsoft can solve this in any way?
This issue is fixed (kinda)
@mousetraps pointed that Microsoft is shipping the C++ build tools separately now. Check here
Some updates on this gigantic thread
Absolutely non-official statement that @Microsoft is aware of this issue and seeing what can be done
@mousetraps said that this thread "is high on people's radar" at @Microsoft
Very good Q&A about noge-gyp issues on Windows and why they happen
@dekarguy took the time to answer some questions about what we all are going through
Couldn't manage to change my user folder since I have the Home version. Anyway it shouldn't matter since it's running from Program Files and not users. I managed to update npm and still I get the same errors. I find this issue absolutely ridiculous: I'm just trying to add a package (addict) to an Elixir/Phoenix Framework project, but that package has a dependency on another package (comeonin) which in turn points to a dependency compilation error in bcrypt wich in turn points to its dependency on node-gyp giving this error.
Couldn't manage to change my user folder since I have the Home version.
In Home you can't put your computer into Domain, can't use group policy management and some other small things... I can't see problem with profile.

Six steps that I did:
- Add +1 admin account
- Login with this new account in Safe Mode
- Open regedit and go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList - Change selected key with old user name to new (edited by @addaleax: There was a screenshot here before which has since been replaced by an advertisement for a potentially harmful site, so I’ve removed it – see https://github.com/nodejs/node-gyp/issues/1063)
- Rename your
C:\Users\oldprofile toC:\Users\new. - Reboot and log-in to your account. Now you can delete useless admin account.
Some more info here: (edited by @addaleax: Removed link here too, for the same reason)
Anyway it shouldn't matter since it's running from Program Files and not users.
Nope. Npm uses appdata folder because it's a global module but running from program files. Also you can see that from your console output:
C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt>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.
blowfish.cc
bcrypt.cc
bcrypt_node.cc
..\src\bcrypt.cc(232): warning C4267: '=' : conversion from 'size_t' to 'unsigned char', possible loss of data [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcryp
t\build\bcrypt_lib.vcxproj]
c:\users\mesos_000\.node-gyp\0.12.7\deps\uv\include\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory (..\src\bcrypt_nod
e.cc) [C:\Users\mesos_000\AppData\Roaming\npm\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
Steps to update npm on Windows:
- cmd
npm i -g [email protected](global update)cd "C:\Program Files\nodejs"andnpm i [email protected]npm -v(must be 3.2.0)
More info: https://github.com/npm/npm/wiki/Troubleshooting#upgrading-on-windows
Managed to do what I wanted with a symlink created.
@mesosteros, Can you describe what you have done?
@Sogl I did it like so:
Run Command Prompt (as administrator):
cd C:\Users
mklink /d mesos mesos_000
Then run the Developer Command Prompt installed with Visual Studio 2015 (from the start menu -> applications), also as administrator, going to
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\
and running the command vcvarsall.bat amd64
Finally, I created a completely new phoenix project in my elixir projects folder, added
{:addict, ">= 0.1.0"}
Then the part where I was getting the error:
mix deps.get
mix deps.compile comeonin
and pronto.
Windows 7, Visual Studio 2013 Professional, python 2.7.3, tried doing
npm install kafka-node
Both it failed gloriously, all coming down to this one
npm install snappy
Went through a ton of instructions on how to set things up, got the Windows SDK 7.1, the Microsoft Build Tools 2013 and thing seem to progress well, then I finally get this error:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Platforms\x64\Microsoft.Cpp.x64.Targets(507,5): error MSB8008: Specified platform toolset (v120) is not installed or invalid. Please make sure that a supported PlatformToolset value is selected. [D:\sample\node_modules\snappy\build\deps\snappy\snappy.vcxproj]
For the life of me I can't get past this, check a couple things on the internet, and still can't find a way to get around it, even though node-gyp and pangyp say they support VS2013 on Windows 7
I ended up finding this page: https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/
Went through the additional steps, setting msvs_version to 2010 and installing VS2010 + SP1
Voila, everything installs.
I need to make instructions for the rest of my development team to set this up, and having them install Windows SDK (seems unavoidable), VS2010 (seems avoidable) and setting up an msvs_version seems like a whole heck of a lot more per-user setup than should be neccesary
my current setup is this:
- Install visual studio with the visual c++ option enabled
- install python2
setx GYP_MSVS_VERSION 2015(i'm using visual studio 2015)
after that, everything runs just fine.
@mesosteros, Good! I'll try it today on my VM.
@dekarguy, v120 = vs 2012
Did you try to specify vs 2013 version with --msvs_version=2013? I didn't install vs 2010 in my last configuration.
@Sogl Definitely tried with --msvs_version=2013, v120 is actually 2013, really confusing and annoying
@luisrudge setx GYP_MSVS_VERSION 2013 didn't help
it's GYP_MSVS_VERSION
fixed my typo and no dice
:( Did you install the visual c++ thing?
On my Windows 7 x64, node-gyp works fine with VS2015 without setting GYP_MSVS_VERSION. If we summarize what's been written in this issue about VS2015, we'll get only two important points to check:
- The C++ part of the VS was installed. By default, it isn't.
- The user profile folder is named only in English letters. No other languages, no characters like underscore (
_) etc.
@luisrudge Are you sure GYP_MSVS_VERSION is really required? Doesn't it work for you without it? What's your OS?
win 8.1 x64 installed Python compiler installed npm 3.2 installed Visual Studio Express 2105 installed Windows 7 SDK added user with latin-only name
it compiles! Run cmd NOT as admin (user with latin-only name in dir path) cmd: SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140 - some problems with my PATH set GYP_MSVS_VERSION 2015 npm install
and it's done! (problem was with compiling bcrypt) Thanks a lot for all advises! Hope my info will be useful
@ProtomotoReal Thank you!!!
I was able to run a normal cmd window (not the Windows SDK 7.1 prompt)
SET VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120
I didn't need to set the GYP_MSVS_VERSION, nor the npm config msvs_version variable
It looks like for my team to get set up on Windows 7 + Visual Studio 2013 that the steps will be
Install Python 2.7
npm set python C:\Python27\python.exe --global
Install Windows 7 SDK
SET VCTargetsPath=C:\Program Files (x86)\MSBUILD\Microsoft.Cpp\v4.0\V120 npm install
Thank you all for the help, I think we can all agree that making this easier would be grand
Hi, i had the same problems with npm-gyp. Initially i got a build problem and i solved it following the suggestions in this thread. I have:
Windows 7 x64 Ultimate VS 2012 VS 2013 VS 2015 Python 2.7.6 NPM 2.13.3 NODE 0.12.7 Microsoft Windows SDK 7.1
but during the npm install exit with only an error on parsing package.json:
R:\Progetti\Nodejs\relay>npm install
npm WARN peerDependencies The peer dependency babel-core@* included from babel-loader will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
-
> [email protected] install R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engi
ne.io-client\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild
-
R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\no
de_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\Piero\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
validation.cc
Creating library R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-cl
ient\node_modules\ws\node_modules\utf-8-validate\build\Release\validation.lib and object R:\Progetti\Nodejs\relay\node_modules\webpa
ck-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate\build\Release\
validation.exp
Generating code
Finished generating code
validation.vcxproj -> R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\node_modules\utf-8-validate\build\Release\\validation.node
> [email protected] install R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.i
o-client\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild
R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\no
de_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Users\Piero\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\.
.\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Compilazione dei progetti nella soluzione uno alla volta. Per abilitare la compilazione parallela, aggiungere l'opzione "/m".
bufferutil.cc
Creating library R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-cl
ient\node_modules\ws\node_modules\bufferutil\build\Release\bufferutil.lib and object R:\Progetti\Nodejs\relay\node_modules\webpack-d
ev-server\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil\build\Release\bufferut
il.exp
Generating code
Finished generating code
bufferutil.vcxproj -> R:\Progetti\Nodejs\relay\node_modules\webpack-dev-server\node_modules\socket.io-client\node_modules\engine.io-
client\node_modules\ws\node_modules\bufferutil\build\Release\\bufferutil.node
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "node" "C:\\Users\\Piero\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.13.3
npm ERR! file C:\Users\Piero\AppData\Roaming\npm-cache\qs\4.0.0\package\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: C:\Users\Piero\AppData\Roaming\npm-cache\qs\4.0.0\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! R:\Progetti\Nodejs\relay\npm-debug.log
it seems the soccket.io-client gives problems. I set the msvs_version to 2013.
@pierol, Your node-gyp works fine.
I think this can help: http://stackoverflow.com/questions/17944345/npm-install-cannot-read-package-json
@dekarguy, You can also check my configuration that not need VS: https://github.com/nodejs/node-gyp/issues/629#issuecomment-130513913
Now I'm fighting with VCTargetsPath that can add normal cmd working.
@Sogl i solved thank you the reason was corrupted packages.json files on disk.
ProtomotoReal, many thanx! Finally got it going after a whole weekend of wanting to throw my laptop out the window!
This helped fixing my issues: https://github.com/nodejs/node-gyp/issues/629#issuecomment-132991527