npmnpm-config

python is not a valid npm option


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


Solution

  • 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.