Arisha
Arisha

Reputation: 1

How can i run a demo React Native Code on Phone

Im totally new to React Native and just learned to setup the necessary environments and follow these steps;

  1. Install Node.js
  2. Download Expo client at mobile device
  3. npm install -g create-react-native-app
  4. cd to my desired directory
  5. create-react-native-app some_app_name
  6. cd to my app folder containing default app.js
  7. npm start
  8. basic / empty app will be loaded on my phone and code can be opened using editor of choice.

Now i've downloaded some demo simple apps from github and udemy (with full source code)

I tried to extract the files and cd to the folder and execute "npm start" However, there is always this error

react-native-scripts: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! [email protected] start: react-native-scripts start npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the [email protected] start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

May i know what is missing? How do i get this right?

Upvotes: 0

Views: 1349

Answers (2)

Mathias Silva
Mathias Silva

Reputation: 71

The command to run a react-native app is react-native run-android for android devices and react-native run-ios for ios devices. Are you sure that you are running these commands to start the app?

Upvotes: 1

Ariel Salem
Ariel Salem

Reputation: 357

Seems like this might be a duplicate of:

sh: react-scripts: command not found after running npm start

Upvotes: 0

Related Questions