Christophe
Christophe

Reputation: 2200

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

> [email protected] 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
[email protected] c:\gitrepo\PORT_BDL_BOOTSTRAP
`-- [email protected]
  `-- [email protected]

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 [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\iltorb):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] 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

Upvotes: 1

Views: 2505

Answers (2)

dobriai
dobriai

Reputation: 61

Looks like this problem started with v1.4.0 and got quickly mitigated in v1.4.1 by making iltorb an "optional dependency". So, with the v1.4.1, npm installation tries to compile, but even it it fails, it till proceeds, ignoring the optional dependency.

This latest behavior is slightly better, but still annoying - slow and spews out too much noise in the log.

One can say npm install --no-optional, which will do the trick, but this will apply to all packages, not to just this one! And you have to remember to use this option :-) There is a related npm issue here: https://github.com/npm/npm/issues/14185

For the moment I am just sticking to 1.3.x: "grunt-contrib-compress": "~1.3.0",

Upvotes: 0

Christophe
Christophe

Reputation: 2200

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

Upvotes: 1

Related Questions