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:
// never trust the python env alone
if (err || !execPath.toLowerCase().includes('python2')) {
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.
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.