While playing around with Flux & React I ran into some issues using a yoeman flux generator. It kept failing on “node-gyp rebuild”. If you do any development on Windows you’ve likely run into issues with node-gyp before. The core of the problem is that node-gyp is no longer being actively developed and so it has some old dependencies that a modern development env might not have.
How to fix?
- Goto Control Panel -> Programs and Features and uninstall “Microsoft Visual C++2010 x64 Redistributable” and “Microsoft Visual C++ 2010 x86 Redistributable” (if present)
- Download and install Python 2.7.3 (if you have Python 3.x already installed, just leave it, both can coexist)
- Visual C++ 2010 Express or Visual Studio 2010
- Windows SDK 7.1
- Visual Studio 2010 SP1
- Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1
IMPORTANT: The order of steps above is important!
Now open a command window/console and enter the following commands
npm config set python /Python27/python.exe --global npm config set msvs_version 2010 --global
Finally goto Start -> All Programs -> Microsoft Windows SDK v7.1 -> Windows SDK 7.1 Command Prompt
From this command window the `node-gyp rebuild` command will work.
NOTE: You only need to use the Windows SDK 7.1 Command Prompt when running `npm install`, once installed can go back to normal command window.