0

I'm trying to compile a native node module using

npm i

This fails with error

gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:305:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\bitbucket\node\native_modules
gyp ERR! node -v v6.10.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

However, if I run the node-gyp command manually with

node-gyp rebuild

Then it works fine.

I notice that node-gyp --version returns v3.6.0 whereas in the error message above it's running v3.4.0.

How do I update npm to use the newer version (which seems to work ok)?

Also, why would this be failing on the old version?

I tried the instructions here https://github.com/nodejs/node-gyp/wiki/Updating-npm's-bundled-node-gyp they don't seem to work. I'm on Windows 10.

magritte
  • 7,396
  • 10
  • 59
  • 79

1 Answers1

0

I have this working now. Here's what I did:

Open a command prompt (run as administrator). cd to the node installation folder, then run:

C:\Program Files\nodejs\node_modules\npm>npm uninstall node-gyp --save

C:\Program Files\nodejs\node_modules\npm>npm install node-gyp --save
magritte
  • 7,396
  • 10
  • 59
  • 79