0

I am trying to create a react native app using create-react-native-app. I have npm install.

I have install create react native by adding the following command to my terminal (on mac).

sudo npm install -g create-react-native-app

When I try and create a create react native app by running the following command I get told that the command is not found.

create-react-native-app myNativeApp

bash: create-react-native-app: command not found

Is there any way I can fix this or am I doing something wrong? I am new to create react native app.

7 Answers 7

4

You are running wrong command :

To install react native run :

npm install -g react-native-cli

And then for creating project run :

react-native init AwesomeProject

Here is documentation.

Sign up to request clarification or add additional context in comments.

Comments

2

At moment create-react-native-app is merged with Expo

To install expo see doc

npm install -g expo-cli

Usage: expo [options] [command]


Update:

Try: npm config set prefix /usr/local And then reinstall react. npm install -g create-react-app Run create-react-app my-app

3 Comments

sadly this didn't help
you use homebrew ?
I think It should be npm install -g create-react-native-app. That worked for me
1

I have tried the command and even I got the same error, so I have used

npx create-react-native-app my_first_app

this has worked for me!

you can even use

sudo npm install expo-cli --global

and then use

expo init rn-first-app

Comments

1

You need to use the npx CLI.

From those docs:

React Native has a built-in command line interface, which you can use to generate a new project. You can access it without installing anything globally using npx, which ships with Node.js.

For example:

npx react-native init myNativeApp

1 Comment

Please edit your answer to be more substantive, it doesn't satisfy the Stack Overflow standards for an answer as it is now. It might be deleted otherwise, as it is flagged as low-quality because of its length and content.
1

Try: npm config set prefix /usr/local And then reinstall react. npm install -g create-react-app Run create-react-app my-app

This works for me!

Comments

0

Follow this instruction

1.react-native init Demo Go to that folder,

2.cd Demo

run the command to start package, make sure you started the emulator.

3.react-native start

4.react-native run-android ( For Android Devices)

Comments

0

Install updated NPM

Check path variable in your system(Windows) it should be OsDrive:\Program Files\nodejs\

then,

npm install -g create-react-app

now try,

npx create-react-app <projectname>
cd <projectdirectory>
npm start

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.