node-gyp: Ubuntu 12: binding.gyp not found when running node-gyp configure

13:59 vmplanet@ubuntu /usr/lib/node_modules/node-gyp $ sudo node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.9.5
gyp info using node@0.10.2 | linux | ia32
gyp info spawn python
gyp info spawn args [ '/usr/lib/node_modules/node-gyp/gyp/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/vmplanet/.node-gyp/0.10.2/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/vmplanet/.node-gyp/0.10.2',
gyp info spawn args   '-Dmodule_root_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /usr/lib/node_modules/node-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 (/usr/lib/node_modules/node-gyp/lib/configure.js:415:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:757:12)
gyp ERR! System Linux 3.2.0-39-generic-pae
gyp ERR! command "node" "/usr/bin/node-gyp" "configure"
gyp ERR! cwd /usr/lib/node_modules/node-gyp
gyp ERR! node -v v0.10.2
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok

14:00 vmplanet@ubuntu /usr/lib/node_modules/node-gyp $ which python
/usr/bin/python

Ubuntu 12

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 58 (10 by maintainers)

Most upvoted comments

The solution goes here (Worked for me):

sudo npm cache clean -f sudo npm install -g n sudo n 4.4.5 sudo npm install npm -g sudo npm uninstall node-gyp -g

Then try running npm install.

I find it astonishing 3 years later this hasn’t been fixed yet.

boob mistake

MUST… RESIST… CRASS… JOKE…

I know this is a rather old thread, but I just wanted to point out that this is still an ongoing issue while installing bcrypt and the comments here were my salvation. That, and making sure g++ was installed on the system.

So, if anyone out there comes across a node-gyp rebuild problem try:

  • Deleting ~/.node-gpy folder.
  • sudo apt-get install g++ gyp

And then, npm install bcrypt.

after hours of searching here and there i got install “node-gyp” and its other related modules i tried all possible soulation

sudo npm cache clean -f sudo npm install -g n sudo n 4.4.5 sudo npm install npm -g sudo npm uninstall node-gyp -g

sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-4.8 g+±4.8 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g+±4.8

sudo npm install -g n sudo n stable npm rebuild npm install

sudo apt-get install mongodb make screen p ython-werkzeug python-jinja2 python-lxml python-iso8601 python-six python-setuptools

sudo apt-get install gcc libssl-dev g++ make

npm rebuild npm install

Now my node and npm version are: npm -v 4.0.5 node -v v7.4.0

Your solution does not work, this is still broken.

hello guys ! i still have this problem can you help me out! capture

ok, so i’m the boob, i got back to where i was… at least it was repeated. there’s report on SO (http://stackoverflow.com/questions/20911930/when-trying-to-configure-or-rebuild-node-gyp-getting-errors-mac-osx-mavericks): here’s the trace

gyp info it worked if it ends with ok
gyp info using node-gyp@0.13.0
gyp info using node@0.10.26 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/rfatahi/Desktop/hichartsServer/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/rfatahi/.node-gyp/0.10.26/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/rfatahi/.node-gyp/0.10.26',
gyp info spawn args   '-Dmodule_root_dir=/Users/rfatahi/Desktop/hichartsServer',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /Users/rfatahi/Desktop/hichartsServer) 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 (/usr/local/lib/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/rfatahi/Desktop/hichartsServer
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 

when run node-gyp configure build i get the following trace:

$ node-gyp configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.13.0
gyp info using node@0.10.26 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/rfatahi/Desktop/hichartsServer/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/rfatahi/.node-gyp/0.10.26/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/rfatahi/.node-gyp/0.10.26',
gyp info spawn args   '-Dmodule_root_dir=/Users/rfatahi/Desktop/hichartsServer',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: /Users/rfatahi/Desktop/hichartsServer) 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 (/usr/local/lib/node_modules/node-gyp/lib/configure.js:340:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Darwin 13.0.0
gyp ERR! command "node" "/usr/local/bin/node-gyp" "configure" "build"
gyp ERR! cwd /Users/dir
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.13.0
gyp ERR! not ok 


> rfatahi

In my case I had to switch from node 8.1 back to node 7.10, remove node_modules and run again npm install.

Upgrade gcc version is solution for me, (default is 4.6.3 on my ubuntu 12.04)

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

The sequence of commands I ended up using were:

sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install gcc-4.8 g++-4.8
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

Checking again the gcc version:

$ gcc --version
gcc (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1

Then go npm install or npm update on your node_modules.

I found the solution here: http://stackoverflow.com/questions/33532528/nodejs-4-5-npm-install-fail-for-bcrypt-and-db-migrate/33532529#33532529

@hocuspucus Can you stop posting content-free comments? If something isn’t working for you, please file a new issue.