Update
From node-gyp@5.1.0 onwards, python3 will be used for the build, therefore please follow the steps below, but replace the last step with
PYTHONPATH=python3 && npm i
Recently, I faced the problem where node-gyp rebuild
failed due to PYTHONPATH is pointing to python3. This is due to python2 is being deprecated, and python
now points to python3 by default. While node-gyp requires python2 to build.
To solve this on macOS, just make sure you reinstall python 2 and python 3 and point PYTHONPATH environment variable to python2.
# Only do this if `where python2` output nothing
brew uninstall --ignore-dependencies python2 python3
brew install python2 python3
PYTHONPATH=python2 && npm i
DONE!
References
Top comments (0)