-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure that python.exe is actually of version 2 #987
Comments
As a workaround, it sounds like I don't quite understand why it's not working for you out of the box, though. node-gyp looks for python2.exe first before it consults the python launcher, unless you pass |
Well there's no python related env variable set here, and I'm not passing I'd probably suggest checking for the launcher before anything else but seeing that it's not that simple to "parse" the launcher it might be quite some overhead by doing that. I haven't really checked what exactly Just for the record: |
Okay, I think that explains it. node-gyp first looks for python2.{exe,bat,cmd}. If that fails, it tries python.{exe,bat,cmd} and only then does it fall back to the python launcher. On your system, it's picking up (and rejecting) the python3 python.exe when it could still fall back to the python launcher. I'll tweak the logic. |
The way the python check is currently implemented in |
@emigenix Did you check the PR? does that solve it for you? You can test it by using |
@neico Actually that fixed the installation error of $ npm install -g node-red
npm WARN deprecated [email protected]: you can use npm install i18next from version 2.0.0
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
C:\Users\xxx\AppData\Roaming\npm\node-red -> C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\red.js
C:\Users\xxx\AppData\Roaming\npm\node-red-pi -> C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\bin\node-red-pi
> [email protected] install C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\bufferutil
> node-gyp rebuild
C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\mybin\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 "C:\cygwin64\bin\python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\mybin\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack at C:\mybin\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\mybin\\nodejs\\node.exe" "C:\\mybin\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\bufferutil
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
> [email protected] install C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\utf-8-validate
> node-gyp rebuild
C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\mybin\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 "C:\cygwin64\bin\python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\mybin\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:401:14)
gyp ERR! stack at C:\mybin\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:356:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\mybin\\nodejs\\node.exe" "C:\\mybin\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\xxx\AppData\Roaming\npm\node_modules\node-red\node_modules\utf-8-validate
gyp ERR! node -v v6.4.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
...
[etc] |
@neico I've fixed that error! It's due to how Cygwin treats symbolic links. It doesn't do that properly in an out-of-the box installation. So the error messages above become misleading, as it complains about the The resolution for out-of-the-box Cygwin users is this: # Open a native Windows CMD in Administrator mode and:
cd C:\cygwin64\bin\
mklink python.exe python2.7.exe The result should look like this: C:\cygwin64\bin>ls -al python*
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python -> python2.7.exe
lrwxrwxrwx 1 xxx xxx 16 Jun 2 2015 python-config -> python2.7-config
lrwxrwxrwx 1 Administrators xxx 13 Aug 24 17:28 python.exe -> python2.7.exe
lrwxrwxrwx 1 xxx xxx 13 Jun 2 2015 python2 -> python2.7.exe
lrwxrwxrwx 1 xxx xxx 16 Jun 2 2015 python2-config -> python2.7-config
-rwxr-xr-x 1 xxx xxx 1685 Jun 2 2015 python2.7-config
-rwxr-xr-x 1 xxx xxx 9235 Jun 2 2015 python2.7.exe Therefore the @bnoordhuis Can you guys please update your installation README info for Windows/Cygwin users? EDIT I posted a full answer here. |
I have faced and fixed this issue relates node-sass and python error.Try installing latest angular cli command with the steps below Set the system variable path as well: C:\Users\windowsusername\AppData\Roaming\npm\node_modules@angular\cli\bin; C:\Program Files\nodejs; Then start using angular cli command prompt using: angular client project folder path>npm install -g node-gyp |
On my windows machine I've got the python launcher (py.exe) including python3 by default inside my PATH. this results in gyp assuming that the python.exe found is ok and runs into a version mismatch afterwards.
What I did to work around this is to ensure in checkPython() that if there's a python.exe, it'll most likely also have 'python2' in it's path somewhere, if it doesn't, handle it as if which failed by changing lib/configure.js:344 to this:
This is not perfect as it relies on at least one ES6 function and I think there might be a more elegant method, maybe letting checkPythonVersion() actually return the version and work out based on that if that executable should be used.
That's why I didn't put this up as a PR but as a issue for someone to figure out the best course of action.
For me, after changing this line the new checkPythonLauncher() resulted in my setup working fine afterwards so I'm going to live with that.
The text was updated successfully, but these errors were encountered: