Search code examples
javascriptreactjsreact-nativereact-native-iosreact-native-cli

Can I install react native Cli through terminal globally?


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?


Solution

  • 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