mozilla / node-client-sessions

secure sessions stored in cookies
Mozilla Public License 2.0
759 stars 104 forks source link

Failed to install due to missing Python #129

Closed patatrak closed 6 years ago

patatrak commented 6 years ago

I tried to install through npm, but it failed. It's true Python is not installed on my system.

My understanding is that installing client-session actually means build it, and this is done through node-gyp, that looks for Python. Is there a way to install a pre-built module or am I definitely compelled to install Python ?

Full log is attached, and here is console output:

2017-11-23T19_23_23_236Z-debug.log the output on the console:

npm install client-session

client-session@0.1.7 install D:\booky\node_modules\client-session node-gyp rebuild

D:\booky\node_modules\client-session>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\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 PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21) gyp ERR! System Windows_NT 10.0.16299 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gy.js" "rebuild" gyp ERR! cwd D:\booky\node_modules\client-session gyp ERR! node -v v8.1.4 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! client-session@0.1.7 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the client-session@0.1.7 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Patrice\AppData\Roaming\npm-cache_logs\2017-11-23T19_23_23_236Z-debug.log

devniel commented 6 years ago

It seems that you first need to run this command: npm --add-python-to-path='true' --debug install --global windows-build-tools

saxbophone commented 6 years ago

A similar problem also occurs if your default system python is python 3 rather than python 2 (the version of gyp being used in this project does not appear to support python 3). This can be fixed by running:

npm config set python $(which python2)
patatrak commented 6 years ago

Hi all,

First of all, I'd like to thank you for the answers: I'm not really available these times but now I can give you feedback.

I'm not on a Windows system anymore, but on a ubuntu one, and I don't have this error anymore since Python is already present. Anyway, I think your answer can help someone else.

Thanks.

spences10 commented 6 years ago

For me I installed python 2.7 and pointed my .npmrc there:

sudo apt install -y python
npm config set python python2.7
saxbophone commented 6 years ago

@patatrak Thanks, I think I should just add that this problem can also occur on macOS (I encountered it when using such).