pythonnpm-installgyp

Where is the "python" environment variable set?


I have run into an issue with installing some npm packages for an app on Windows 10. Specifically gyp seems to be causing trouble, because it cannot find the python executable.

Here is part of the output of npm install in PowerShell:

enter image description here

Previously I had Cygwin installed, but then I deleted it, updated to Windows 10 and installed the Linux Subsystem for Windows. But obviously the Cygwin python path is still somewhere set in an environment variable.

The problem is, I cannot find this environment variable.

The python environment variable is set to C:\Users\myaccount\.windows-build-tools\python27\python.exe.

The path environment variable only contains C:\Users\myaccount\.windows-build-tools\python27\, no other python directories.

There is no pythonpath environment variable.

I checked all these variables with PowerShell and in Extended System Settings.

Where on earth is npm or gyp taking the python path from?


Solution

  • As it turned out, before looking at the environment variables gyp looks in npm-config for a python entry. In my case the python entry was set like this:

    ; userconfig C:\Users\myaccount\.npmrc
    python = "C:\\cygwin64\\bin\\python2.7.exe"
    

    After deleting the python entry in npm-config with

    npm config delete python
    

    gyp found the python executable trough the python environment variable.