Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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'

```

like image 861
lopezdp Avatar asked May 18 '18 23:05

lopezdp


People also ask

Is Python required for node-gyp?

node-gyp requires that you have installed a compatible version of Python, one of: v3. 7, v3. 8, v3. 9, or v3.

What is node-gyp in npm?

node-gyp is a cross-platform command-line tool written in Node. js for compiling native addon modules for Node. js. It contains a vendored copy of the gyp-next project that was previously used by the Chromium team, extended to support the development of Node. js native addons.


1 Answers

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
like image 65
Ashok JayaPrakash Avatar answered Nov 12 '22 07:11

Ashok JayaPrakash