Search code examples
node.jsnpmnode-gyp

Can't find python executable with node-gyp rebuild when installing with npm


Hello I'm getting the following error when I try to install prerequisites to compile with sass:

$ npm install

> iltorb@1.0.13 install c:\gitrepo\PORT_BDL_BOOTSTRAP\node_modules\iltorb
> node-gyp rebuild

c:\gitrepo\PORT_BDL_BOOTSTRAP\node_modules\iltorb>if not defined npm_config_node_gyp (node "C:\Users\CTH\Desktop\bazar\nodejs\node\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )
  else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at failNoPython (C:\Users\CTH\Desktop\bazar\nodejs\node\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack     at C:\Users\CTH\Desktop\bazar\nodejs\node\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack     at C:\Users\CTH\Desktop\bazar\nodejs\node\node_modules\npm\node_modules\graceful-fs\polyfills.js:264:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:82:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "c:\\Users\\CTH\\Desktop\\bazar\\nodejs\\node\\node.exe" "C:\\Users\\CTH\\Desktop\\bazar\\nodejs\\node\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd c:\gitrepo\PORT_BDL_BOOTSTRAP\node_modules\iltorb
gyp ERR! node -v v5.6.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
bootstrap@4.0.0-alpha.5 c:\gitrepo\PORT_BDL_BOOTSTRAP
`-- grunt-contrib-compress@1.4.1
  `-- lodash@4.17.4

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.0.13 (node_modules\iltorb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: iltorb@1.0.13 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

I've set the PYTHON and PYTHONPATH variables, that doesn't change anything. The problem is related to node-gyp rebuild that doesn't work probably due to my python executable. I use a python portable version for windows could it be related to that ?

I've tried also this without success:

npm config set python C:\Users\CTH\Desktop\bazar\python\App\python.exe

Solution

  • So after searching for some time I think I've found a solution : my python version was 3.2.7 but it seems that node-gyp only accepts versions that are below 3 so I've found a portable version of python version 2.7.6.1 that seems to solve my problem.

    To compile I had to rebuild with this command as it seems that the proxy was not passed:

    node-gyp rebuild --proxy=http://proxy:8080