python is not a valid npm option

28.1k Views Asked by At

I am trying to set an older version of python in order to install modules and build an old node project.

I run this command:

npm config set python=python2.7

OR

npm config set python C:\Python27\python.exe

In both cases I am getting this error:

npm ERR! `python` is not a valid npm option 

Nove v16.14.2

Npm v9.1.2

3

There are 3 best solutions below

2
On BEST ANSWER

Consider downgrading npm to v8 for now:

npm install -g npm@^8

Alternatively, just run:

npm config edit

and add:

python=C:\Python27\python.exe

in a new line.

0
On

Update your npm

npm install -g npm@^8

Retry the command

npm config set python C:\Python27\python.exe
0
On

Consider running fix command:

npm config fix

In my case, it resolved the issue