gyp ERR! stack Error: Can't find Python executable

Danil Zinchenko picture Danil Zinchenko · Apr 29, 2019 · Viewed 7.6k times · Source

I've removed node-modules, reinstall it, tried to install npm install --global node-gyp, cleaned force cache and other

error C:\Users\danil\work\cryptobetting\node_modules\sha3: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\danil\work\cryptobetting\node_modules\sha3
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Programs\Python2.7\python2.7.exe", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\danil\work\cryptobetting\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\danil\work\cryptobetting\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Users\danil\work\cryptobetting\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\danil\\work\\cryptobetting\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\danil\work\cryptobetting\node_modules\sha3

Answer

Reed Dunkle picture Reed Dunkle · Sep 18, 2019

The node-gyp installation instructions provide two options to get all of their necessary dependencies, including Python 2.

Option 1

Install all the required tools and configurations using Microsoft's windows-build-tools using npm install --global --production windows-build-tools from an elevated PowerShell or CMD.exe (run as Administrator).

npm install --global --production windows-build-tools

Option 2 is to install them manually, individually. Read everything here: https://github.com/nodejs/node-gyp#on-windows