Search code examples
node.jsnpmnode-gyp

node-gyp installation failures on Windows


  • Node Version: node -v and npm -v

node v8.11.2

npm v6.0.1

  • Platform: uname -a (UNIX), or systeminfo | findstr /B /C:"OS Name" /C:"OS Version" /C:"System Type" (Windows)

Windows

  • Compiler: (UNIX) or `msbuild /version & cl</code> (Windows) --> Windows
  • Module: node canvas

Verbose output (from npm or node-gyp):

I have tried to install node-gyp from npm according to the instructions for windows on the node-gyp repo: https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules

I have python 2.7 installed

I have changed the npm config setting to point to the right version of python

I followed the option2 instructions and I have GTK running correctly. I see the demo widget for GTK when I run the cmd.

I enter the next command:

node-gyp rebuild --GTK_Root=C:\Users\davidlop\Documents\Software\GTK

and all I get is: bash: node-gyp: command not found

I have tried every fix, I have uninstalled and reinstalled node npm.

I have followed the instructions to the letter. How do I install this? I am trying to work with node canvas and node-gyp is required... What am I doing wrong?

```

I lost track of the log and where it is. Once I get some progress and a new log I will post.

Also I added my $PATH/users/AppData/Roaming/npm directory to my PATH. The error I get is:

Error: Cannot find module 'C:\Program Files\Git\node_modules\node-gyp\bin\node-gyp.js'

```


Solution

  • Make sure you have installed node-gyp globally. Looking on your issue it seems that node-gyp.js file is not available in the specified path.

    Node Gyp installation for Windows

    npm install -g node-gyp
    

    After installing node-gyp globally, Open command prompt as an Administrator and run the following command to install window build tools.

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

    After installation, Run the following command to rebuild your GTK.

    node-gyp rebuild --GTK_Root=C:\Users\davidlop\Documents\Software\GTK