Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-gyp rebuild error #94

Closed
ashalaenko opened this issue Jul 5, 2012 · 35 comments
Closed

node-gyp rebuild error #94

ashalaenko opened this issue Jul 5, 2012 · 35 comments

Comments

@ashalaenko
Copy link

/usr/local/lib/node_modules# node-gyp rebuild


gyp info it worked if it ends with ok
gyp info using node-gyp@0.5.7
gyp info using node@0.8.1
gyp info spawn python
gyp info spawn args [ '/root/.node-gyp/0.8.1/tools/gyp_addon',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-I/usr/local/lib/node_modules/build/config.gypi',
gyp info spawn args   '-f',
gyp info spawn args   'make' ]
Traceback (most recent call last):
  File "/root/.node-gyp/0.8.1/tools/gyp_addon", line 38, in <module>
    rc = gyp.main(gyp_args)
  File "/root/.node-gyp/0.8.1/tools/gyp/pylib/gyp/__init__.py", line 471, in main
    options.circular_check)
  File "/root/.node-gyp/0.8.1/tools/gyp/pylib/gyp/__init__.py", line 111, in Load
    depth, generator_input_info, check, circular_check)
  File "/root/.node-gyp/0.8.1/tools/gyp/pylib/gyp/input.py", line 2289, in Load
    depth, check)
  File "/root/.node-gyp/0.8.1/tools/gyp/pylib/gyp/input.py", line 361, in LoadTargetBuildFile
    includes, True, check)
  File "/root/.node-gyp/0.8.1/tools/gyp/pylib/gyp/input.py", line 208, in LoadOneBuildFile
    raise Exception("%s not found (cwd: %s)" % (build_file_path, os.getcwd()))
Exception: binding.gyp not found (cwd: /usr/local/lib/node_modules) while trying to load binding.gyp
gyp ERR! rebuild error Error: `gyp_addon` failed with exit code: 1
gyp ERR! rebuild error     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:290:16)
gyp ERR! rebuild error     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! rebuild error     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! not ok 
@TooTallNate
Copy link
Contributor

From your prompt it looks like you're running the command in /usr/local/lib/node_modules. So what module are you trying to build?

@TooTallNate
Copy link
Contributor

Exception: binding.gyp not found (cwd: /usr/local/lib/node_modules) while trying to load binding.gyp

^ That

@ashalaenko
Copy link
Author

So, I tried to use that :
npm install iconv -g

And got this error.

@TooTallNate
Copy link
Contributor

@ashalaenko Can you output the entire log including the command?

@jamcoupe
Copy link

I am getting the same issue, is there a solution?

 macbook-air:/ root$ sudo node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.5.8
gyp info using node@0.8.0 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/Users/root/.node-gyp/0.8.0/tools/gyp_addon',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-I/build/config.gypi',
gyp info spawn args   '-f',
gyp info spawn args   'make' ]
Traceback (most recent call last):
File "/Users/root/.node-gyp/0.8.0/tools/gyp_addon", line 38, in <module>
rc = gyp.main(gyp_args)
File "/Users/root/.node-gyp/0.8.0/tools/gyp/pylib/gyp/__init__.py", line 471, in main
options.circular_check)
File "/Users/root/.node-gyp/0.8.0/tools/gyp/pylib/gyp/__init__.py", line 111, in Load
depth, generator_input_info, check, circular_check)
File "/Users/root/.node-gyp/0.8.0/tools/gyp/pylib/gyp/input.py", line 2289, in Load
depth, check)
File "/Users/root/.node-gyp/0.8.0/tools/gyp/pylib/gyp/input.py", line 361, in LoadTargetBuildFile
includes, True, check)
File "/Users/root/.node-gyp/0.8.0/tools/gyp/pylib/gyp/input.py", line 208, in LoadOneBuildFile
raise Exception("%s not found (cwd: %s)" % (build_file_path, os.getcwd()))
Exception: binding.gyp not found (cwd: /) while trying to load binding.gyp
gyp ERR! configure error Error: `gyp_addon` failed with exit code: 1
gyp ERR! configure error     at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:290:16)
gyp ERR! configure error     at ChildProcess.EventEmitter.emit (events.js:91:17)
gyp ERR! configure error     at Process._handle.onexit (child_process.js:674:10)
gyp ERR! not ok
macbook-air:/ root$ 

@gavinr
Copy link

gavinr commented Sep 18, 2012

I'm experiencing this issue too. What was the resolution?

@TooTallNate
Copy link
Contributor

Everyone, node-gyp configure must be run from the root directory of a node module. @jamcoupe Invoking it at / is likely not what you want to do.

@gavinr
Copy link

gavinr commented Sep 18, 2012

Thanks @TooTallNate. I agree. Just to reiterate, if you are getting this error you need to go to the node module folder (for me this was happening with node-sqlserver, located at USERDIR/node_modules/node-sqlserver) and run the node-gyp configure command from there. Thanks!

@jonbarlo
Copy link

jonbarlo commented Jan 7, 2013

hello guys,

I'm having a problem trying to running node-sqlserver on my windows 7 machine...
Already have installed and working
-node.js
-appFog
-ruby (command prompt)
-python

So what i've done so far is to download everything in one "test" folder, when try to execute the node-gyp configure im gettin this:

C:\Users\jonathan.barquero\Documents\node.js source\test>node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.8.2
gyp info using node@0.8.16 | win32 | x64
gyp info spawn python
gyp info spawn args [ 'C:\Users\jonathan.barquero\Documents\node.js source
test\node_modules\node-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 'C:\Users\jonathan.barquero\Documents\node.js source
test\build\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\jonathan.barquero\Documents\node.js source
test\node_modules\node-gyp\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\Users\jonathan.barquero.node-gyp\0.8.16\common.g
ypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\Users\jonathan.barquero.node-gyp
0.8.16',
gyp info spawn args '-Dmodule_root_dir=C:\Users\jonathan.barquero\Documents
\node.js source\test',
gyp info spawn args '--depth=.',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\Users\jonathan.barquero\Documents\node.js source
test\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\Users\jonathan.barquero\Documents\node.js so
urce\test) 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\jonathan.barquero\Document
s\node.js source\test\node_modules\node-gyp\lib\configure.js:420:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "node" "C:\Users\jonathan.barquero\Documents\node.js source
\test\node_modules\node-gyp\bin\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\jonathan.barquero\Documents\node.js source\test
gyp ERR! node -v v0.8.16
gyp ERR! node-gyp -v v0.8.2
gyp ERR! not ok

I know im getting the "gyp: binding.gyp not found (cwd: C:\Users\jonathan.barquero\Documents\node.js so
urce\test) while trying to load binding.gyp" but wondering why im getting this error if i do have everything nested in one folder

Untitled

in within the folder node_modules i have the two github projects (node-gyp & node-sqlserver)

Untitled1

I already tryed to go to the node module folder as @gavreh mentioned but it didnt worked i got the same result, so im afraid im still not getting how to solve this, could any of you guys help me a bit

Thanks!
Appreciate it

@whitef0x0
Copy link

I'm currently getting the same problem.

@ganna-shmatova
Copy link

one of about 7 issues i've been having installing node-gyp

@kala725
Copy link

kala725 commented May 30, 2016

Try running the following commands and then run npm install, this will take the node's default node-gyp module. (No need to have multiple as node package already provides that)

Updating the node & NPM

sudo npm cache clean -f
sudo npm install -g n
sudo n 4.4.5
sudo npm install npm -g

Removing additional Node-gyp module

sudo npm uninstall node-gyp -g
sudo npm uninstall node-gyp

@niftylettuce
Copy link

Your solution does not work, this is still broken.

@krylatij
Copy link

krylatij commented Dec 1, 2016

Go to the folder with binding.gyp of your module and run "node-gyp configure" from it.

@seatownrocks
Copy link

binding.gyp does not exist...

ERSmith@S7-ERSMITH-L MINGW64 ~/AppData/Roaming/npm/node_modules/node-gyp/gyp
$ node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.1 | win32 | x64
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main                                           .py',
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   'C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\build\\c                                           onfig.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\ERSmith\\.node-gyp\\6.9.1\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\ERSmith\\.node-gyp\\6.9.1',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-gyp                                           ',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-                                           gyp\\gyp',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\Users\ERSmith\AppData\Roaming\npm\node_modules\node-gyp\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\ERSmith\AppData\Roaming\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 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\ERSmith\\AppData\\Roaming\\npm\\node                                           _modules\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd C:\Users\ERSmith\AppData\Roaming\npm\node_modules\node-gyp\gyp
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok

@mrmodise
Copy link

mrmodise commented Feb 9, 2017

After hours of struggling with this issue. All I did was npm config set GYP_MSVS_VERSION 2015. I also pointed Python to npm as well as Visual Studio version. Your .npmrc file found in the home directory should look like this:

msvs_version=2015
python=C:Python27python.exe
GYP_MSVS_VERSION=2015

Ofcourse having Visual C++ installed together with Visual Studio (I used community edition, it had both)

@Spaxe
Copy link

Spaxe commented Mar 20, 2017

Having the same problem with @seatownrocks, but on Ubuntu 16.04 LTS.

$ sudo node-gyp configure build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.0
gyp info using node@7.7.3 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/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   '/usr/lib/node_modules/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   '/root/.node-gyp/7.7.3/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/7.7.3',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/usr/lib/node_modules',
gyp info spawn args   '-Dnode_engine=v8',
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: /usr/lib/node_modules) 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:336:16)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-22-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "configure" "build"
gyp ERR! cwd /usr/lib/node_modules
gyp ERR! node -v v7.7.3
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok 

@ctzurcanu
Copy link

+1 for mac

@Spaxe
Copy link

Spaxe commented Mar 22, 2017

Update, looks like @krylatij was on point. You have to run configure in a folder where binding.gyp is, or you will get this error.

Problem solved once I found the right folder.

@ctzurcanu
Copy link

i have not found such file on my computer. note: i had to change recently to python3 and only today i am installing python2 alongside (just because gyp does not support ver 3)

@gibfahn
Copy link
Member

gibfahn commented Mar 22, 2017

@ctzurcanu what are you trying to use node-gyp for? It's a tool for building native node modules, and every native node module should have a binding.gyp file in the root.

For example, you could clone node-report (a small native module in the nodejs foundation), and run node-gyp configure in that.

npm install -g node-gyp # This should put node-gyp in the path if it's not already
git clone https://github.com/nodejs/node-report.git
cd node-report
node-gyp configure

@ctzurcanu
Copy link

@gibfahn thank you. I wanted to build https://github.com/wekan/wekan and i see no binding.gyp in the source while in node-report is clearly present in the root..
I should understand that the source there is incomplete.

@gibfahn
Copy link
Member

gibfahn commented Mar 22, 2017

@ctzurcanu I don't think wekan is a native module. node-gyp is for building native modules (i.e. C++ code not just JavaScript).

But basically if you just want to use modules, npm install should just work (for native and non-native modules), you shouldn't need to use node-gyp directly.

@gibfahn
Copy link
Member

gibfahn commented Mar 22, 2017

Also that module has a pretty detailed Wiki page, if you want to install I recommend reading the docs for the module.

@ctzurcanu
Copy link

@gibfahn thank you. It is exactly because following that Wiki page that I got in this trouble. They said on it to install gyp before npm install. But at your recommendation: I skipped that step and all that was of interest to me runs fine now :)

@M-Abozaid
Copy link

same here on Ubuntu

@gibfahn
Copy link
Member

gibfahn commented Apr 4, 2017

@M-Abozaid (and anyone else planning to comment) can you please raise an issue on https://github.com/nodejs/help ? Your issue is almost certainly not a node-gyp error.

Feel free to include a link to this issue and to cc/ me in the issue.

@dachendev
Copy link

dachendev commented Apr 29, 2017

I am trying to install node-opus and keep getting node-gyp related errors to the binding.gyp
npm i node-opus --save

EDIT: It might be an issue with the node-opus package, just installed opusscript instead without any problems.

@refack
Copy link
Contributor

refack commented Apr 29, 2017

@jndachenhaus depending on which platform you are working on (Windows/linux/mac) there are some steps you need to take in order for node-gyp to function properly.
The README is now quite good, and has gone trough allot of improvempt. If you follow it's instructions node-gyp should work.

@feixuwu
Copy link

feixuwu commented Aug 6, 2017

OK, I found the same error, because I only install visual studio 2017 and the node-gyp currently didn't support visual studio 2017, I changed the MSVSVersion.py script(under C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\gyp\pylib\gyp),
and then fix this problem.
after fix the problem you can use command to install, I opened visual studio 2017 command prompt
and go to the project folder then type the comand:
for example: npm install dnode --msvs_version=2017

In the MSVSVersion.py, you need add code 3 position:

1、In function _CreateVersion, you can add vs2017 like this:
versions = {
'2017': VisualStudioVersion('2017',
'Visual Studio 2017',
solution_version='12.00',
project_version='14.1',
flat_sln=False,
uses_vcxproj=True,
path=path,
sdk_based=sdk_based,
default_toolset='v141'),

2、In _DetectVisualStudioVersions function, add one line:
'14.1': '2017',

3、In SelectVisualStudioVersion function, add one line:
'2017': ('14.1',),

this works for me, only installed visual studio 2017.

@suyingtao
Copy link

sudo npm i

@AlexandreBonneau
Copy link

On my end, I had to do this to force a rebuild manually:

cd node_modules/fibers
npm install

Then I could use my project as usual.

@askucher
Copy link

askucher commented Oct 2, 2018

same here ubuntu. damn hate this issue

@A-lee-201
Copy link

npm install iconv -g

This worked for me. Thanks!

@ouqunfu
Copy link

ouqunfu commented May 6, 2019

@feixuwu This worked for me. Thanks! In Windows , install canvas will error, so I installed GTK , it worked.

targos pushed a commit to targos/node-gyp that referenced this issue Aug 22, 2021
This is mostly to make Fedora's .rpm builder happy.
But it won't hurt now that Python 2 is unsupported in gyp-next.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests