Quantcast
Channel: User Hamfri - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Answer by Hamfri for gyp error when I want to do React native npm install

$
0
0

If you are on an M1 MacBook or any Apple Silicon chip Macbook the default python installation is Python 3.8.9 or higher this might cause issues during compilation and linking of certain libraries like node-sass. To resolve this issue you have two options:

  • Find a replacement for the library that is causing npm errors. Inthe case of node-sass, you can install npm install sass.
  • If there are no replacements for your library then you have to installpython 2 on your system. Follow steps 1 - 6
  1. $ brew install pyenv
  2. $ pyenv install 2.7.18
  3. Set the following environment variables in your .zshrc or .bashrc depending on your default shell.
export PATH=$(pyenv root)/shims:$PATHexport PATH="$(pyenv root)/versions/2.7.18/bin:$PATH"
  1. $ source ~/.zshrc or ~/.bashrc depending on your default shell.
  2. npm config set python python2.7
  3. $ rm -rf node_module && npm i

Copy the commands after $ and execute them on your terminal.


Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>