1

I want to install react-native cli but I don't where to run this command: npm install -g react-native-cli. Do I need to run this command on my macOS terminal or when I will make a directory for my react native app then there I need to run this command in vscode?

Is there any issue if I run this command in my terminal or If I run this in VScode?

Harsh Mishra
  • 862
  • 3
  • 15
  • 29

4 Answers4

4

React Native is distributed as two npm packages, react-native-cli and react-native.

The first one is a lightweight package that should be installed globally (npm install -g react-native-cli), while the second one contains the actual React Native framework code and is installed locally into your project when you run react-native init.

Because react-native init calls npm install react-native, simply linking your local GitHub clone into npm is not enough to test local changes. npm install –g react-native-cli · This line installs the npm package react-native-cli along with its dependencies(from the npm repository host) inside the globally shared node_modules folder.

· Global install (with -g): puts stuff in /usr/local or wherever node is installed. This will also allow you to access the module from the command-line, as the bin is symlinked into a PATH folder (usually usr/local/bin).

Refer below link https://rlogicaltech.medium.com/how-to-install-react-native-on-mac-step-by-step-guide-1ac822aedd4f

Mohammad Ayoub Khan
  • 2,422
  • 19
  • 24
SnehalM
  • 118
  • 6
2

You can run the command anywhere in the terminal. It will install the react-native-cli globally as we are specifying the "-g" option in the command.

Jignesh Mayani
  • 6,937
  • 1
  • 20
  • 36
2

Use this

npm install -g expo-cli
Daksharaj kamal
  • 526
  • 1
  • 4
  • 11
0

this how I solved it. npm install -save react-native@latest

houcin olmostaf
  • 191
  • 1
  • 12