exercism / gui

MIT License
22 stars 13 forks source link

node-gyp requires python 2 on windows #38

Closed robphoenix closed 8 years ago

robphoenix commented 8 years ago

On my Windows 7 system Python 3 is my primary python version. When running npm install in the root gui directory I get the following error:

C:\Users\robertph\code\gui\node_modules\electron-rebuild\node_modules\nslog>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: Python executable "C:\Users\robertph\AppData\Local\Programs\Python\Python35-32\python.EXE" is v3.5.1, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.
gyp ERR! stack     at failPythonVersion (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:406:14)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:395:9
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:204:7)
gyp ERR! stack     at emitTwo (events.js:87:13)
     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\robertph\code\gui\node_modules\electron-rebuild\node_modules\nslog
gyp ERR! node -v v4.4.6
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

This is fixed by including the --python switch: npm install --python=python2.7

holandes22 commented 8 years ago

Thanks for bringing this up, had no idea we have a dependency depending on python...

Is there anything we can do in package.json to enforce this? Otherwise I'll document on the README. I'll need to add to the README python2 as a requirement for dev I guess

robphoenix commented 8 years ago

I don't know about enforcing in the package.json I'm afraid, but I'd be happy to add something into the README if you like?

holandes22 commented 8 years ago

That would be great, thank you!