Skip to content
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

npm install fails due to using wrong python version when run from batch (yet works when run via command prompt/powershell) #140

Open
NbrTDB opened this issue Sep 15, 2020 · 0 comments

Comments

@NbrTDB
Copy link

NbrTDB commented Sep 15, 2020

I have encountered this odd situation trying to use nw-gyp on a Windows 10 system with Python38 and Python27 in the system PATH.

On this system, if I run npm install --msvs_version=2017 via the command prompt/powershell, everything works just fine.

But when it is run via a batch file as part of a build script, the process fails, citing syntax errors that are a clear indicator it's trying to use Python 3 instead of Python 2.

I've tried various things within the batch file to encourage the right python target to be used (not all at the same time, just listing them below) and all of them were ineffectual:

set PYTHON=C:\Python27\python.exe
set npm_config_python=C:\Python27\python.exe
npm config set python C:\Python27\python.exe
npm install --python=python2.7 --msvs_version=2017

It should be noted that I can see Python27 listed in npm config ls -l and npm config get python if used in the batch file will echo the desired Python 2.7 path. At this point I have run out of ideas, it seems like all attempts to declare a target for Python are ignored when npm install is called from batch.

I do have a not-ideal workaround: if I simply shuffle the environment variables around such that Python27 is first, I can use nw-gyp without problem.

This seems rather similar to #122 (certainly, the issue of nw-gyp seemingly ignoring path variables does appear to be the case).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant