I'm having some issues with the node-gyp package, and I believe it's because I need to use python 2.7 rather than python 3.
I have set-up my PATH environment variables so that when I do python --version the output is Python 2.7.16.
However, in the same terminal, when I go to yarn install my project. It fails, and I can see the output of the logs is:
Command: node-gyp rebuild
Arguments:
Directory: /Users/myname/Documents/myproject
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.7.3 found at "/Users/myname/anaconda3/bin/python"
I am also using nvm. Catalina 10.15.2. Node 12.14.0. NVM 0.33.11.
Why does my terminal version show me as using 2.7, but then the logs show the command node-gyp rebuild as using 3.7.3? If I've already set-up my environment variables, what can I change to rectify this? Is it something to do with nvm?
If experiencing this issue on an M1 Mac, see the accepted answer to this question (basically for Node versions older than 15, you need to open Terminal using Rosetta):
nvm install node fails to install on macOS Big Sur M1 Chip
This solution worked for me (on an M1 MacBook Pro) when the other answers here did not work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With