nodejs / node-gyp

Node.js native addon build tool
MIT License
9.94k stars 1.8k forks source link

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

Closed ewallteam closed 5 years ago

ewallteam commented 5 years ago

Hi,

I have followed the below steps to install PWA.

https://magento-research.github.io/pwa-studio/venia-pwa-concept/setup/

But when trying to install build tools and configure the python dependency, we are facing this issue in windows 10. gyp: binding.gyp not found (cwd: C:\Users\xxxx) while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1

And also we have tried the same steps in ubuntu system and it results the following error.

make: *** No targets specified and no makefile found. Stop.

So, kindly let us know how to fix this.

Thanks,

bzoz commented 5 years ago

What command are you using to install build tools? Can you provide full verbose log?

ewallteam commented 5 years ago

Thanks for the reply.

I have followed the steps from this link. https://github.com/nodejs/node-gyp#installation

  1. npm install -g node-gyp
  2. My system is windows, so I have used option 1 - npm install --global --production windows-build-tools
  3. npm install --global --production windows-build-tools
  4. For configuring python dependency node-gyp --python /path/to/python2.7 - (/path/to/python2.7 - I have changed this to the location of python in my system).
  5. npm config set python /path/to/executable/python2.7 - (/path/to/executable/python2.7 - I have changed this to the location of python in my system)
  6. Then node-gyp configure

After that the below error occurs.

gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@10.15.3 | win32 | x64 gyp info spawn C:\Python27\python.exe gyp info spawn args [ 'C:\Users\xxx\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 'D:\PWA\build\config.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\xxx\AppData\Roaming\npm\node_modules\node-gyp\addon.gypi', gyp info spawn args '-I', gyp info spawn args 'C:\Users\xxx\.node-gyp\10.15.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=C:\Users\xxx\.node-gyp\10.15.3', gyp info spawn args '-Dnode_gyp_dir=C:\Users\xxx\AppData\Roaming\npm\node_modules\node-gyp', gyp info spawn args '-Dnode_lib_file=C:\Users\xxx\.node-gyp\10.15.3\<(target_arch)\node.lib', gyp info spawn args '-Dmodule_root_dir=D:\PWA\', 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 'D:\PWA\build', gyp info spawn args '-Goutput_dir=.' ] gyp: binding.gyp not found (cwd: D:\PWA) 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\xxx\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:345:16) gyp ERR! stack at ChildProcess.emit (events.js:189:13) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) gyp ERR! System Windows_NT 10.0.17134 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\xxx\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "configure" gyp ERR! cwd D:\PWA gyp ERR! node -v v10.15.3 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok

bzoz commented 5 years ago

Could you provide output of node-gyp configure --verbose

ewallteam commented 5 years ago

The above error is the verbose of node-gyp configure

bzoz commented 5 years ago

Right, sorry.

So, the error message is gyp: binding.gyp not found (cwd: D:\PWA) while trying to load binding.gyp. Is the binding.gyp file there?

ewallteam commented 5 years ago

No, the file is not there.

alxmrs commented 5 years ago

@bzoz I'm having a similar issue. Will it help to share my configuration as well?

bzoz commented 5 years ago

If the file is not there, then this is not an issue with node-gyp, but with the whatever project you are trying to build. You should report it to the package authors.

Tenodec commented 5 years ago

for example,cd node_modules/ffi,then node-gyp rebuild

rvagg commented 5 years ago

I'm going to close this due to staleness but as the above comment says, the node-gyp rebuild --verbose output should be generated within the directory of the addon that's failing. The above output has gyp: binding.gyp not found (cwd: D:\PWA) while trying to load binding.gyp -- if you are creating an addon inside D:\PWA then this simply means you need to create an appropriate binding.gyp in there. IF you are having trouble building a dependency addon, cd into node_modules\whateveraddon and do the node-gyp rebuild in there. There should be a binding.gyp in that directory, or it's not a proper addon and maybe this isn't node-gyp's problem.

jdmarshall commented 4 years ago

I'm seeing node-gyp fail for hashring and node-syslog when trying to run yarn install. Same project, different directory, has no problems with npm install. I wonder if this is node-gyp or yarn.

ghost commented 4 years ago
{
    "targets": [{
        "target_name": "binding",
        "sources": [ "<PATH TO NODE>" ]
    }]
}
WilliamMega commented 4 years ago

I have the same problem, could someone help me?

gyp info spawn args 'C:\build', gyp info spawn args '-Goutput_dir=.' gyp info spawn args ] gyp: binding.gyp not found (cwd: C:) 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\willi\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:350:16) gyp ERR! stack at ChildProcess.emit (events.js:315:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Windows_NT 10.0.18363 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\willi\AppData\Roaming\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" gyp ERR! cwd C:\ gyp ERR! node -v v12.18.1 gyp ERR! node-gyp -v v7.0.0 gyp ERR! not ok

bzoz commented 4 years ago

@WilliamMega

gyp: binding.gyp not found (cwd: C:) while trying to load binding.gyp

cwd to the directory with the binding.gyp file.

osahady commented 4 years ago

same issue! Any suggestion? gyp: binding.gyp not found (cwd: C:\node_modules) while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1

kuro-kuma commented 3 years ago
  • Try to resolve the missing file issue first:
  • gyp: binding.gyp not found (cwd: D:\PWA) while trying to load binding.gyp
  • Create the file manually 'binding.gyp' and add this content to it:
  • Change the path for the source Mac OS's normally goes in ( /usr/local/bin/node )
{
    "targets": [{
        "target_name": "binding",
        "sources": [ "<PATH TO NODE>" ]
    }]
}

you are right! thanks!

shubhamrk2 commented 2 years ago
  • Try to resolve the missing file issue first:
  • gyp: binding.gyp not found (cwd: D:\PWA) while trying to load binding.gyp
  • Create the file manually 'binding.gyp' and add this content to it:
  • Change the path for the source Mac OS's normally goes in ( /usr/local/bin/node )
{
    "targets": [{
        "target_name": "binding",
        "sources": [ "<PATH TO NODE>" ]
    }]
}

where to find the path in windows, please help