I’ve been looking for the answer to this for a good solid week now, with no success. I’ve looked at every StackOverflow post, every article from Google and every related Github issue I could find. Most related errors seem to be older, so I’m wondering if my issue is slightly different due to me being on macOS Big Sur.
When I try to run
yarn install in my local repo, I receive an error related to node-gyp and a python executable that is unable to be found. Here is what my terminal shows:
yarn install v1.22.17 ...other stuff [4/4] ðŸ”¨ Building fresh packages... [6/13] â node-sass [2/13] â node-sass [10/13] â metrohash [4/13] â fsevents error /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash: Command failed. Exit code: 1 Command: node-gyp rebuild Arguments: Directory: /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash Output: gyp info it worked if it ends with ok gyp info using [email protected] gyp info using [email protected] | darwin | x64 gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "/usr/local/opt/[email protected]/bin/python3", you can set the PYTHON env variable. gyp ERR! stack at PythonFinder.failNoPython (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/node-gyp/lib/configure.js:484:19) gyp ERR! stack at PythonFinder.<anonymous> (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/node-gyp/lib/configure.js:406:16) gyp ERR! stack at F (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:68:16) gyp ERR! stack at E (/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:80:29) gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/which/which.js:89:16 gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/isexe/index.js:42:5 gyp ERR! stack at /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/isexe/mode.js:8:5 gyp ERR! stack at FSReqCallback.oncomplete (fs.js:167:21) gyp ERR! System Darwin 20.6.0 gyp ERR! command "/Users/jimmiejackson/.nvm/versions/node/v12.18.0/bin/node" "/Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash/node_modules/.bin/node-gyp" "rebuild" gyp ERR! cwd /Users/jimmiejackson/Documents/repositories/repo-name/node_modules/metrohash
I’m not entirely sure what this error means or why this node module is searching for python3. I’ve tried running
npm set config /path/to/python, downloading python3, setting the PYTHON path in my .zshrc profile, but nothing seems to be working. It’s entirely possible that my lack of understanding of the issue means that I’m on the right path but didn’t quite get something right. Any ideas?
gyp-node source might helps. Here are some steps you can try.
Install python2. You should make sure that in the terminal,
which -a python2only returns one
python2 -Vreturns the correct 2.x version.
Rerun the install.
If there’s still an error, probably the error message is different.