jhipster - gyp verb `which` failed Error: not found: python2

Just a note for anyone using React and facing the same error on Linux (Ubuntu):

Step 1: Install python 2.7

  • something similar to this
     sudo apt update
     sudo apt install python2-minimal
    

Step 2: Install make or just build-essential

  • something like:
    sudo apt-get install build-essential
    

Then you can proceed with your previous activity...


I just ran into this as well.

  • I had to install Python 2.7 Here

  • I also needed to downgrade my node version to 6.16 [Link to how to install and uninstall] (https://blog.teamtreehouse.com/install-node-js-npm-windows)


Yes node-gyp requires Python 2.7, so you could try the answers to this question.

Alternatively, if you encounter this problem, it is probably due to node-sass and if you did not select Sass in JHipster options, you don't need it but still you get it because it's a transitive dependency from Angular, you can skip it by setting environment variables:

set SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
set SKIP_NODE_SASS_TESTS=true

Another alternative is to use JHipster devbox.


There is another workaround to this error:

  1. Delete your node_modules folder.
  2. Run npm install --global windows-build-tools --save in your command prompt.
  3. Install node-sass using the command: npm install [email protected] --save (or the latest version)

This should solve the error and return you a gyp info ok message!

If you encounter Node Sass could not find a binding for your current environment, resolve it by running:

npm rebuild node-sass