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

binding.gyp not found (cwd: c:\Users\xxxx\xxxx\) while trying to load binding.gyp #702

Closed
gonadn opened this issue Aug 24, 2015 · 49 comments
Labels
bcrypt ERR! node-gyp -v < v10.x.x npm install -g npm Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952 Windows

Comments

@gonadn
Copy link

gonadn commented Aug 24, 2015

Hi

Iam having trouble to configure "node-gyp",
I followed this article "https://github.com/nodejs/node-gyp" for installation of "node-gyp", and it was working before i messed up my configuration on my computer, node-gyp just stop working. By searching on google i found different explanations, but nothing fixed my issue.

Below is screenshot of when i Run the command "node-gyp configure"
I hope that the path to root directory is correct?

node

By searching on google i found out that if i put an empety binding.gyp file in folder where iam running the command to configure node-gyp , then something start happening, but then i get another error to . So something is maybe missing here or i have done something i cant figure out...

I have installed VS2012 Express and VS2015 PRO, i also have run the npm command to set python and npm to --msvs_version=auto

Any clue on how to configure node-gyp on windows 8.1?

@bnoordhuis
Copy link
Member

What exactly are you trying to do? node-gyp is for building add-ons. From your screenshot, it looks like you're trying to build node-gyp itself.

@gonadn
Copy link
Author

gonadn commented Aug 24, 2015

oki, iam trying to install bcrypt, when i first tried to install bcrypt i got an error saying that i need to run node-gyp rebuild, and thats where all started... I need to install Bcrypt...

And i have done all the installation steps described:

I need to install bcrypt...

@gonadn
Copy link
Author

gonadn commented Aug 24, 2015

bnoordhuis , Where shoud i run this command from? in witch directory?

In installation describtions they say that you need to run the command from the root directory of you node.....what does it mean?

@bnoordhuis
Copy link
Member

node-gyp is installed along with npm, there should be no need to install it separately. If you get an error when you npm install bcrypt, you should take that up with the bcrypt project first.

@gonadn
Copy link
Author

gonadn commented Aug 25, 2015

I no that, problom is when i try to install bcrypt i get an error saying that i have to run "node-gyp configure" before installing the bcrypt. And when i run node-gyp configure, i get another error saying that node-gyp cannot find the binding.gyp file......!! And i cant find any binding.gyp file in the root of directory....

@TooTallNate
Copy link
Contributor

You should not need to run node-gyp configure manually. This happens implicitly when npm install bcrypt is run.

Closing since not a node-gyp issue.

@gonadn
Copy link
Author

gonadn commented Aug 26, 2015

the solution in my case was to run this command:

set PATH=C:\Program Files (x86)\MSBuild\14.0\Bin;%PATH%

@shraddha22
Copy link

I am getting the same issue. I tried a lot but couldnt fix this issue. Setting Path with MSBuild is also not working for e. I am getting this issue when I am trying to install ursa module. Also, i am using VS2012 Express.Please help
npm install

@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

@waltdakind
Copy link

I am running into the same problem, the sudo commands are not applicable to a windows environment (and the npm package 'n' is not either). I get the same binding.gyp, and that's after successfully reinstalling node-gyp using the msvs_version. Elsewhere I've seen suggestions to reinstall Python. Anyone have other ideas?

@Steviey
Copy link

Steviey commented Oct 9, 2016

+1

2 similar comments
@wzup
Copy link

wzup commented Nov 16, 2016

+1

@h4ck4life
Copy link

+1

@lber19535
Copy link

Just use VS developer command prompt if you have VS

@makiJS
Copy link

makiJS commented Jan 21, 2017

+1

1 similar comment
@td4b
Copy link

td4b commented Feb 16, 2017

+1

@Steviey
Copy link

Steviey commented Feb 16, 2017

I fixed it somehow after two weeks or so. It was a hell of trial and error.
The process was so complex, that at the end I wasn't sure what fixed it.
Gyp is an illness. Good luck!

Personal possible fix reasons on Win 7 from my notes (without any warranty):

  • C++ Build Tools + Win 8 SDK + Win 10 SDK
  • Env Vars: GYP_MSVS_VERSION = 2015
  • VS140COMNTOOLS = C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools
    Path = %ProgramFiles%\MSBuild\14.0\Bin;[...]
  • latest Python 2.x
  • reboot
  • I also did something under /node_modules/ for specific appliances like Electron, SQlite etc.

PS:
Possibly the worst error traps (with tons of side effects), I've ever seen in my developer career.
We all should know who did this crappy shit to us.
And why the hell this issue is still closed and not fixed in general.

Trial and error belongs to machine learning, not to essential developer tools used by humans.

@a3zzat
Copy link

a3zzat commented Mar 28, 2017

the same issue and no solution

@adamwallace
Copy link

I feel pretty silly, but I realized that I didn't have Visual C++ 2015 Build Tools and Visual Studio with Common Build tools (or relevant C++ addons). I installed both of those and didn't have this problem anymore.

@SaiMounikaRao
Copy link

SaiMounikaRao commented May 11, 2017

mounika$ node-gyp configure --msvs_version=2015
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.1
gyp info using node@7.4.0 | darwin | x64
gyp info spawn /usr/bin/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/mounika/FULLClient-Electron-aw-lily/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/mounika/.node-gyp/7.4.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/mounika/.node-gyp/7.4.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/mounika/FULLClient-Electron-aw-lily',
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: /Users/mounika/FULLClient-Electron-aw-lily) 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:336: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 Darwin 16.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "configure" "--msvs_version=2015"
gyp ERR! cwd /Users/mounika/FULLClient-Electron-aw-lily
gyp ERR! node -v v7.4.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok 

Can anyone help me to solve this error?

@gibfahn
Copy link
Member

gibfahn commented May 11, 2017

@SaiMounikaRao is there a binding.gyp file in your working directory (/Users/mounika/FULLClient-Electron-aw-lily)?

Also it looks like you're using a Mac, but --msvs_version=2015 is a Windows specific option.

@SaiMounikaRao
Copy link

No binding.gyp is not present in my directory.

@gibfahn
Copy link
Member

gibfahn commented May 12, 2017

@SaiMounikaRao so what exactly are you trying to do? You should just be able to do npm install in /Users/mounika/FULLClient-Electron-aw-lily, I'm not sure why you're running node-gyp directly.

@SaiMounikaRao
Copy link

SaiMounikaRao commented May 12, 2017

Ya I got it now it's working fine.
Actually I have already done with "npm install" in my directory after that when I am trying to run my code it's showing that error. So I have tried with different things and now my problem got solved.

@mailparikshit
Copy link

how did you resolved your problem??

@refack
Copy link
Contributor

refack commented May 17, 2017

Suggested solutions that came up in this thread:

  1. Make sure you have a compiler set up - https://github.com/nodejs/node-gyp/#installation
  2. Make sure you have the latest npm - https://docs.npmjs.com/getting-started/installing-node
  3. sometimes node-gyp does not need to be run directly, running npm i will trigger it binding.gyp not found (cwd: c:\Users\xxxx\xxxx\) while trying to load binding.gyp #702 (comment)

@mailparikshit what exactly is the problem you are seeing? You could open a new issue with the error out you got?

@btoo
Copy link

btoo commented Dec 30, 2017

im using the Windows Subsystem for Linux and i was able to fix my problem by doing sudo apt-get install g++

@AymaxLi
Copy link

AymaxLi commented May 15, 2018

@shraddha22 I got the same issue as you. have you solved it ? (;′⌒`)

@odahcam
Copy link

odahcam commented May 15, 2018

I was able to solve with npm install --global --production windows-build-tools available at https://www.npmjs.com/package/windows-build-tools.

Sometimes I needed to uninstall and reinstall some software for a fresh start, but everything works fine after the build tools instalation.

@mmouih
Copy link

mmouih commented Jul 2, 2018

I've been running for the same issue for the past few days, here what you need to do :

I guess most people (it was my case) forget to simply add binding.gyp

Hope it helps ...

@divgit
Copy link

divgit commented Feb 28, 2019

My solution on Windows 10.
Only these solution helps.
You need file visualcppbuildtools_full.exe !!
Go here https://visualstudio.microsoft.com/ru/visual-cpp-build-tools/
My link: https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe
You require file: visualcppbuildtools_full.exe.
Install all versions for windows 8.1 and 10 (~6-8Gb).
Its create folder C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140...
And be happy :-)

@giegiey
Copy link

giegiey commented May 4, 2019

I create binding.gyp file manually under the path c:\users\leon\appdata\roaming\npm\node_modules\node-gyp with following content:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/Release/binding.node" ]
}
]
}.
After that, I run node-gyp rebuild command and the issue is solved.

Best answer .

@Tenodec
Copy link

Tenodec commented Jun 3, 2019

My solution on Windows 10.
Only these solution helps.
You need file visualcppbuildtools_full.exe !!
Go here https://visualstudio.microsoft.com/ru/visual-cpp-build-tools/
My link: https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe
You require file: visualcppbuildtools_full.exe.
Install all versions for windows 8.1 and 10 (~6-8Gb).
Its create folder C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140...
And be happy :-)

it is useful

@shanemac10
Copy link

I create binding.gyp file manually under the path c:\users\leon\appdata\roaming\npm\node_modules\node-gyp with following content:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/Release/binding.node" ]
}
]
}.
After that, I run node-gyp rebuild command and the issue is solved.

This worked for me!
Here is a more detailed answer...

If you run node-gyp rebuild, or in my dumb case sudo node-gyp rebuild -g --unsafe-perm=true, you will probably be looking at a bunch of these logs... gyp ERR! ....

Right in-between the gyp info and the gyp ERR! look for something like this...
gyp: binding.gyp not found (cwd: /Users/yourUsername/Documents/YourProject/YourSubFolder) while trying to load binding.gyp

This is the folder where you need to add a binding.gyp file that contains...

{
	"targets": [
		{
			"target_name": "binding",
			"sources": [ "build/Release/binding.node" ]
		}
	]
}

Then try running node-gyp rebuild again! Good luck all!

@LincolnTx
Copy link

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

This solve my issue, thanks man

@yupeng-yuxiaoyu
Copy link

You need to create it
https://github.com/nodejs/node-gyp#the-bindinggyp-file

@pauljfx
Copy link

pauljfx commented Nov 14, 2019

If you, like me, found this page and do not understand what all these people are talking about but having the same problem (error message when trying to install yarn/npm install) maybe we are in the same boat.

I understand that it is a little off-topic, but I hope it helps someone:

So I got this error trying to install something with dependency on node-sass.
The node-sass dependency has older version and apparently does not support the latest node version I have on my computer.
So to solve this I could either upgrade node-sass or downgrade node.

Cheers.

@dukeatcoding
Copy link

dukeatcoding commented Nov 22, 2019

@pauljfx to which version of node did you downgrade - is 11 fine or do you need to go back further?

I used nvm for windows, installed node version 11.14.0 and it worked for me.

@min9nim
Copy link

min9nim commented Jan 28, 2020

Maybe this helps you if you are on MacOS catalina (v.10.15.XX).

https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md

@konstantinkrassmann
Copy link

node-sass

This brought me here. I updated my nodejs to 12 and apparently i didnt check node-sass for compatibility setting it's version to 4.13.1 fixed the whole thing. (remove node_models and package-lock.json afterwards and npm i )

@nevergrind
Copy link

I create binding.gyp file manually under the path c:\users\leon\appdata\roaming\npm\node_modules\node-gyp with following content:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/Release/binding.node" ]
}
]
}.
After that, I run node-gyp rebuild command and the issue is solved.

Why did you put a period at the end? It works without the period. Perhaps obvious to some, but not all.

@djD-REK
Copy link

djD-REK commented Apr 30, 2020

This is the folder where you need to add a binding.gyp file that contains...

{
	"targets": [
		{
			"target_name": "binding",
			"sources": [ "build/Release/binding.node" ]
		}
	]
}

Then try running node-gyp rebuild again! Good luck all!

This worked for me.

@newsfusion
Copy link

I had the same issue on Ubuntu 18.04. I needed to switch the python version to 2.7 to solve it:

update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

@cclauss
Copy link
Contributor

cclauss commented Jan 15, 2021

Yeah. If there are the lines...

gyp ERR! node -v v0.12.4
gyp ERR! node-gyp -v v2.0.2

... like it says above then you have to use legacy Python because you are using legacy Node and legacy Node-gyp.

Perhaps provide 1. the command that you typed and 2. the full output so that we are not flying blind.

@cclauss cclauss added the Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952 label Jan 15, 2021
@fz3hra
Copy link

fz3hra commented Mar 3, 2021

I create binding.gyp file manually under the path c:\users\leon\appdata\roaming\npm\node_modules\node-gyp with following content:
{
"targets": [
{
"target_name": "binding",
"sources": [ "build/Release/binding.node" ]
}
]
}.
After that, I run node-gyp rebuild command and the issue is solved.

Please can you tell me how you created the file? Im new to this. I cant figure it out

@Nisthar
Copy link

Nisthar commented Apr 9, 2021

I've been running for the same issue for the past few days, here what you need to do :

I guess most people (it was my case) forget to simply add binding.gyp

Hope it helps ...

Isn't this file supposed to be inside the node module that you are installing?

@byteab
Copy link

byteab commented Jul 29, 2021

I am not sure
maybe this work
node-gyp configure

@cclauss cclauss added the ERR! node-gyp -v < v10.x.x npm install -g npm label Jul 29, 2021
@nodejs nodejs locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bcrypt ERR! node-gyp -v < v10.x.x npm install -g npm Node Sass --> Dart Sass https://github.com/sass/node-sass/issues/2952 Windows
Projects
None yet
Development

No branches or pull requests