node-gyp installation failures on Windows

11,789

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
Share:
11,789
lopezdp
Author by

lopezdp

go hard in the paint.

Updated on June 04, 2022

Comments

  • lopezdp
    lopezdp almost 2 years
    • 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'

    ```

  • lopezdp
    lopezdp almost 6 years
    Thanks for the answer. I found a work around that didnt involve node-gyp so I apologize since I cant get you real feedback. Ill mark as accepted and hope it helps someone else.
  • B''H Bi'ezras -- Boruch Hashem
    B''H Bi'ezras -- Boruch Hashem about 4 years
    @lopezdp what did u end up doing? I have same problem
  • lopezdp
    lopezdp over 3 years
    @bluejayke I honestly cant remember, but I think this had something to do with some python work I was doing and I may have been trying to set something up with Anaconda maybe. I believe in this situation I scrapped whatever direction I was going in because this was a nightmare and found a better and more efficient approach. I think I just went with a direct install of JupiterLab. Im thinking this problem goes away with Window's new Linux Subsystem? not sure at all... hope you find your way out of it tho!