21

I am trying to "node-gyp configure" to try to get the ms sql server driver. However, initially it said binding.gypi was missing or something to that effect. Now however it is saying common.gypi not found. So I created a text document relabelled it as common.gypi and pasted the code from the file common.gypi that I found in the github repository into the file and saved it and closed it and ran "node-gyp configure". This is the output.

D:\Node\SQLServerConnector\node-sqlserver-master>node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.10.6
gyp info using node@0.10.15 | win32 | ia32
gyp info spawn python
gyp info spawn args [ 'C:\Users\Suresh\AppData\Roaming\npm\node_modules\n
ode-gyp\gyp\gyp',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'D:\Node\SQLServerConnector\node-sqlserver-master\buil
d\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'D:\Node\SQLServerConnector\node-sqlserver-master\comm
on.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Suresh\AppData\Roaming\npm\node_modules\n
ode-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\Suresh\.node-gyp\0.10.15\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\Suresh\.node-gyp\0.10.15',
gyp info spawn args '-Dmodule_root_dir=D:\Node\SQLServerConnector\node-sqls
erver-master',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'D:\Node\SQLServerConnector\node-sqlserver-master\buil
d',
gyp info spawn args '-Goutput_dir=.' ]
gyp: C:\Users\Suresh.node-gyp\0.10.15\common.gypi not found (cwd: D:\Node\SQLSe
rverConnector\node-sqlserver-master) while reading includes of binding.gyp while
trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\Suresh\AppData\Roaming\npm
\node_modules\node-gyp\lib\configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "node" "C:\Users\Suresh\AppData\Roaming\npm\node_modules\
\node-gyp\bin\node-gyp.js" "configure"
gyp ERR! cwd D:\Node\SQLServerConnector\node-sqlserver-master
gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.10.6
gyp ERR! not ok

Please help me resolve this error.

5 Answers5

30

I've had luck with:

rm -rf ~/.node_gyp cd myAwesomeProject npm install npm rebuild

when switching between node 4 and 0.12.4

stevethecollier
  • 1,034
  • 11
  • 13
  • 4
    I have been looking for a solid, straightforward answer to this issue forever and somehow only now found your post. I use nvm and I'm guessing different versions of node all use that node-gyp folder and things get corrupted over time. There were some global modules I thought were simply incompatible with node 4 but simply deleting the node-gyp folder solved it :) Cheers! – sunny-mittal Sep 30 '15 at 00:19
  • 1
    Thank you @Jedininjaster - you saved my day – szydan May 20 '16 at 17:00
  • 2
    Removing the `node_gyp` directory was the key! Mine was at `C:\Users\Jarad\AppData\Local\node-gyp` on Windows. – Jarad Jul 22 '22 at 10:34
6

Seems to be a common issue these days.

You can check https://github.com/TooTallNate/node-gyp/issues/313 and https://github.com/TooTallNate/node-gyp/issues/376 to see if any of these solutions solve your issue.

Particularly, you can:

  • Remove old dir ~/.node_gyp and run npm install

  • Copy an older version (ex: ~/.node-gyp/0.10.11/) to the complying path.

  • Copy the latest version to the complying path.

  • Chime in this thread to get help.

Diosney
  • 10,520
  • 15
  • 66
  • 111
0

My solution (on windows) was to go to %appdata%/npm-gypi and delete the folder, after that I could install ganache (which I guess uses gypi as a dependency).

I sure hope this helps someone.. it has been 3 hours of troubleshooting for me..

Edit: Oh and I deleted the npm-cache too

Daniel Bernal
  • 334
  • 3
  • 7
0
  • Error encountered on Windows using Node 18.10.0
PS C:\Users\Mike\git\ngp-projects-api> npm rebuild
more information.
npm ERR! code 1
npm ERR! path C:\Users\Mike\git\ngp-projects-api\node_modules\gcstats.js
npm ERR! command failed
npm ERR! command C:\windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.1.0
npm ERR! gyp info using node@18.10.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.7 found at "C:\Users\Mike\AppData\Local\Programs\Python\Python39\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/node-v18.10.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.10.0/node-v18.10.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v18.10.0/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v18.10.0/SHASUMS256.txt
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v18.10.0/win-x86/node.lib failed, reason: connect ETIMEDOUT 2606:4700:10::6814:162e:443
npm ERR! gyp ERR! stack     at ClientRequest.<anonymous> (C:\Users\Mike\AppData\Local\nvs\node\18.10.0\x64\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR! gyp ERR! stack     at ClientRequest.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at TLSSocket.socketErrorListener (node:_http_client:494:9)
npm ERR! gyp ERR! stack     at TLSSocket.emit (node:events:525:35)
npm ERR! gyp ERR! stack     at emitErrorNT (node:internal/streams/destroy:151:8)
npm ERR! gyp ERR! stack     at emitErrorCloseNT (node:internal/streams/destroy:116:3)
npm ERR! gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19044
npm ERR! gyp ERR! command "C:\\Users\\Mike\\AppData\\Local\\nvs\\node\\18.10.0\\x64\\node.exe" "C:\\Users\\Mike\\AppData\\Local\\nvs\\node\\18.10.0\\x64\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\Mike\git\ngp-projects-api\node_modules\gcstats.js
npm ERR! gyp ERR! node -v v18.10.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
  • Note: Not specifying --nodedir CLI option
  • Problem is related to npm using IPv6 address that is timing out inside corporate Intranet
    • ETIMEDOUT 2606:4700:10::6814:162e:443
  • Work-around was to copy the entire existing cache directory for Node 18.9.1 to a new cache directory called 18.10.0
  • e,g,
C:\Users\Mike\AppData\Local\node-gyp\Cache\18.9.1 --> C:\Users\Mike\AppData\Local\node-gyp\Cache\18.10.0
  • Solution worked for me but doesn't seem kosher
    • I was fortunate to have an existing cache folder to copy from my old Node installation (Node 18.9.1) before upgrading to Node 18.10.0
  • Related Node GitHub issue
0

One line command in powershell:

node "C:\Users\$($env:username)\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" install

The node-gyp.js is in global node_module.