/usr/local/lib/node_modules# node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected]
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
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?
Exception: binding.gyp not found (cwd: /usr/local/lib/node_modules) while trying to load binding.gyp
^ That
So, I tried to use that :
npm install iconv -g
And got this error.
@ashalaenko Can you output the entire log including the command?
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 [email protected]
gyp info using [email protected] | 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$
I'm experiencing this issue too. What was the resolution?
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.
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!
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 [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn python
gyp info spawn args [ 'C:\Users\jonathan.barquero\Documents\node.js source\
test\node_modules\node-gypgypgyp',
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-gyp0.8.16common.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

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

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
I'm currently getting the same problem.
one of about 7 issues i've been having installing node-gyp
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
Your solution does not work, this is still broken.
Go to the folder with binding.gyp of your module and run "node-gyp configure" from it.
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 [email protected]
gyp info using [email protected] | 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
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)
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 [email protected]
gyp info using [email protected] | 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
+1 for mac
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.
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)
@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
@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.
@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.
Also that module has a pretty detailed Wiki page, if you want to install I recommend reading the docs for the module.
@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 :)
same here on Ubuntu
@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.
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.
@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.
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_modulesnode-gypgyp\pylibgyp),
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.
sudo npm i
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.
same here ubuntu. damn hate this issue
npm install iconv -g
This worked for me. Thanks!
@feixuwu This worked for me. Thanks! In Windows , install canvas will error, so I installed GTK , it worked.
Most helpful comment
Your solution does not work, this is still broken.