This is super annoying. Reliance on node-gyp on Windows is such a pain! The error description says the it can not find the Python executable, even though it is there.
There is a workaround – 2021 SOLUTION
- Re-Install node-gyp globally – npm install -g node-gyp@latest
- Delete node-modules
- Delete package lock file
- Reinstall all packages again (pnpm i or npm i)
- PS: I recommend using pnpm instead of npm. It is much faster.
- OLD WORKAROUND FROM 2018
- Open cmd as Administrator (Otherwise the installation fails, meh)
- run command npm install –global –production windows-build-tools
- This will install Visual Studio Build Tools (yes, I know, there is mismatch in names)
- This will also install Python again as a side-effect (meh)
- run npm rebuild in the project’s folder
- re-open cmd and run npm install
- all should be fine now