While I was working locally on some Python project pulled from an archived Git repo, I needed few hours just to setup the environment on a Windows machine, and get it up and running. The error this time was:
gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2
- Python 2
- Python 3 (optional)
Solution #1. (Re)install Python2 and configure PATH.
Step 1. Find and download the latest Python 2.7 version from the official python.org site and make sure to download the Windows x86-64 MSI installer.
Step 2. Once installed, in order to set the environment variables, open the
Run program, type
systempropertiesadvanced and hit Enter.
Step 3. Click
Step 4. Under
System variables, click on
New and add the following entries:
- Make sure Python2.7 is installed under
- If you have Python3 installed as well, make certain
C:\Python3<minor_version>\Scriptsare part of the PATH as well.
Step 5. From the
C:\Python27\ directory, copy
Step 6. Finally, run:
npm config set python c:\python27\python.exe
If that doesn’t work, try running:
npm config set python c:\python3<minor_version>\python.exe
Solution #2. Reinstall node-sass
Step 1. Clear the NPM cache:
npm cache clean --force
Step 2. Remove
node_modules/ folder and
Step 3. Install the latest
node-sass version according to your Node.JS version.
npm i -g node-saas@<version>
Step 4. Install windows-build-tools.
npm i -g windows-build-tools
Step 5. At last, run
Step 1. Uninstall Python3.
Step 2. Repeat the whole process described in Solution #1.
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.