Ivan Dunets Ivan Dunets - 5 months ago 82
Node.js Question

node-gyp problems (build and rebuild) [WINDOWS 8 / WINDOWS 10]

many people have problems with node-gyp on windows 8 or windows 10,

enter image description here

so what is the best way to install and run "node-gyp build" ?

Answer

UPDATE - 21/03/2016

On windows 10 all what you need is follow the official instructions step by step, node-gyp was fixed and now it should work right

https://github.com/nodejs/node-gyp


Here is the solution:

Note: the order of steps is important

  1. Goto Control Panel -> Programs and Features and uninstall “Microsoft Visual C++2010 x64 Redistributable” and “Microsoft Visual C++ 2010 x86 Redistributable” (if present)

enter image description here

  1. Download and install Python 2.7.3 (if you have Python 3.x already installed, just leave it, both can coexist)

  2. Visual C++ 2010 Express or Visual Studio 2010

  3. Windows SDK 7.1

  4. Visual Studio 2010 SP1

  5. Visual C++ 2010 SP1 Compiler Update for the Windows SDK 7.1

  6. 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
    

Source (1-7): https://www.robertkehoe.com/2015/03/fix-node-gyp-rebuild-error-on-windows/

  1. Open your project folder with command window/console and type :

    call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x86
    call "C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\Setenv.cmd" /Release /x64
    
  2. Done! Now you can run this commands:

    node-gyp configure
    node-gyp build