Quickfix: NPM err: gyp verb check python checking for Python executable “python2” in the PATH

Wouter
3 min readFeb 21, 2022

Last week I was working on a very old project that was using a very old sass library. When trying to build the project using the yarn command, I got the following error:

gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2

The console showed me a lot of error lines:

Something was wrong while trying to execute the Python script when building. The error didn’t make sense to me because the Pyton executable worked fine. Opening a new command line and entering python even showed me this:

Meaning python was correctly installed. One of the error messages showed me this:

npm ERR! gyp ERR! stack Error: Can't find Python executable "C:\Python310\python.EXE", you can set the PYTHON env variable.

Which made me come to the conclusion: the script was looking for Python at the wrong place. But why? I had set the python in my system environments path. So after digging a bit I found the solution

How to solve this

Install python

--

--