node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Error: spawn ENOENT

Open badeend opened this issue 13 years ago • 30 comments

Node-gyp refuses to build any native modules I've tried. I'm on Windows 7 64 bit (I'm trying to compile for x86 though, as I don't have the x64 SDK installed). Node-gyp says it's a bug which I need to report, so here I am:

E:\project\node-ffi>node-gyp configure
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | ia32
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack Error: spawn ENOENT
gyp ERR! stack     at errnoException (child_process.js:980:11)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:771:
34)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Users\\Gebruiker\\AppData\\Roaming\\npm\\node_modul
es\\node-gyp\\bin\\node-gyp.js" "configure"
gyp ERR! cwd E:\project\node-ffi
gyp ERR! node -v v0.10.12
gyp ERR! node-gyp -v v0.10.2
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Please file an Issue:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>

badeend avatar Jun 26 '13 20:06 badeend

I would be careful by stating that this error occurs "only" with phyton not installed and not on the path. It cost me a couple of hours to discover (on W8.1, x64) that you need Python on your path as well as a separate ENV variable PYTHON=C:\Python\phyton.exe (or anything that matches the full path to your Python installation). However, with the latest versions of node and gyp as per now but when using an older (recommended?) version, namely 2.7.x of Python you may end up having to change the configure.js script:

  • import platform; print (platform.python_version())
  • import platform; print platform.python_version()

See the discussion over here: https://github.com/TooTallNate/node-gyp/issues/166 ...

Because the configure script does find Python but with the lines above the configure script cannot determine the version and hence you'll end up with the infamous "Error: spawn ENOENT".

mavawie avatar Jan 29 '14 18:01 mavawie

No matter what combination of Python/Node I try I still can not get 'requestify' to install on my Windows machine.

niczak avatar Jan 30 '14 16:01 niczak

This issue is closed, but I don't see what the solution was?... The problem definately still exists.

thany avatar Mar 11 '14 18:03 thany

This problem was coming up for me on our TeamCity box (Windows 2012 x64); I couldn't get it to build any native extensions. Here's the list of things I did to resolve the problem that I pieced together from several different threads:

  1. Installed Python 2.7.6 x64 - download here
  2. Installed VS 2012 Express - download here
  3. Installed Windows 7 SDK - download here
  4. Set an environment variable PYTHON to 'c:\Python27\python.exe' - that's the default install location.
  5. I have to include a flag with every call to npm, '--msvs_version=2012'

Example TeamCity Command Line Task:

cd %teamcity.build.workingDir%
npm --msvs_version=2012 install

HTH

arobson avatar Apr 16 '14 14:04 arobson

The below worked for me.

PYTHONPATH=C:\Pyhon PYTHON=%PYTHONPATH%\python.exe

I also had to add the python in path variable just like path = %PYTHON%

Also, the python version supported is between 2.5 and 3 only.

sahilthadhani avatar Apr 09 '15 23:04 sahilthadhani

For me, this was solved by installing Python 2.7.10 (previously had Python 3.5.2 which was referenced by path as py and python).

I'm running Windows 10, Node v5.0.0

kristofferremback avatar Nov 17 '15 16:11 kristofferremback

For me this was solved by setting :

npm config set python C:\Python27\python.exe

debasishmohanty avatar Jun 07 '16 12:06 debasishmohanty

The solution is to update your system python then set it o NPM configuration

JsDevHub avatar Nov 21 '16 07:11 JsDevHub

@JsDevHub Can you please also explain how to do that then?

thany avatar Nov 25 '16 06:11 thany

In my case I was able to run the Gulp task in the Angular CLI, but was getting this issue in Visual Studio 2017. My solution was to change the order of my paths in Visual Studio. Tools > Options > Projects and Solutions > Web Package Management > External Web Tools

once there, re-order your paths such that $(PATH) is in the list right after your node modules as such:

path

Hope that helps someone.

Judjohn avatar Oct 20 '17 22:10 Judjohn