Workaround for eternal problem with node-gyp on Windows

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.
  1. OLD WORKAROUND FROM 2018
  2. Open cmd as Administrator (Otherwise the installation fails, meh)
  3. run command npm install –global –production windows-build-tools
  4. This will install Visual Studio Build Tools (yes, I know, there is mismatch in names)
  5. This will also install Python again as a side-effect (meh)
  6. run npm rebuild in the project’s folder
  7. re-open cmd and run npm install
  8. all should be fine now
npm hell
npm hell