npm ERR! missing script: android - react-native

I get several npm ERR! when trying to run : D:\React Native\cleanProject>npm run android
npm ERR! missing script: android
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2019-03-26T08_39_44_164Z-debug.log
npm i
D:\React Native\cleanProject>npm run android
npm ERR! missing script: android
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Roaming\npm-cache_logs\2019-03-26T08_39_44_164Z-debug.log

The command that you are trying to run is doesn't exist. Please try to run with this given below command.
react-native run-android

I think you need to run the following command for installing 'react-native' project to your Node JS first.
npm install react-native
After that, also make sure an emulator is started or cell phone is connected with developer mode.
And then retry by running
react-native run-android
to see if you can build and run the your application successfully.

check if your environment variable set properly.
In your PATH Variable:
C:\Users[Username]\AppData\Local\Android\Sdk\platform-tools C:\Users[Username]\AppData\Local\Android\Sdk\tools
C:\Program Files\nodejs
In your system Variable
ANDROID_HOME C:\Users[Username]\AppData\Local\Android\Sdk
JAVA_HOME C:\Program Files\Java\jdk1.8.0_191
Hope it works...

Follow this command, it works for me
npx react-native run-android

make sure you are in the root directory of your app before using react-native run-android
1- open your project and make sure you see the android rectory
2- in the address bar at the top type cmd and a new cmd will open at that location
3- type react-native run-android
I hope it helps

Related

my cli dont work with npx command become an error

have a little problem with my npm package it works with npm but not when I used npx. Do I understand correctly that if I use npx i don't have to do an installation ?
Become this error -> Error: ENOENT: no such file or directory, lstat
but npx should install everything temporary or not ?
Here is the link to my npm package:
https://www.npmjs.com/package/sweetstack?activeTab=readme
Thank you so much for help
Had is install with npm i -g sweetstack and starting sweetstack how it's run.

Why do I keep getting this error code when starting Expo client

To run the app, choose one of:
› Scan the QR code above with the Expo app (Android) or the Camera app (iOS).
› Press a for Android emulator, or i for iOS simulator, or w to run on web.
› Press e to send a link to your phone with email.
Press ? to show a list of all available commands.
Logs for your project will appear below. Press Ctrl+C to exit.
Error: EMFILE: too many open files, watch
at FSEvent.FSWatcher._handle.onchange (internal/fs/watchers.js:178:28)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: expo start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
brew install watchman
running this command solved my exactly same problem. if you look at the error message you are getting, it says:
Error: EMFILE: too many open files, watch at
FSEvent.FSWatcher._handle.onchange.
react native is able to use watchman internally to watch its files. I hope this will work for your as well
Oybek's solution did not work for me, but it would work if had Intel based Mac computer.
For those who have Apple M1 Silicon based machine such command may be daysaver:
arch -arm64 brew install watchman
or
arch -arm64 brew reinstall watchman
when you have some bad installation of watchman already done.

I get 'react-native' is not recognized as an internal or external command when I run "npx react-native init AwesomeProject"

I have installed node and jdk8 using chocolaty.
While I was following the official guide "Setting up the development environment -> React Native ClI Quick start for 'Windows & Android'" I get the following error when I run npx react-native init AwesomeProject command:
'react-native' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code 1
npm ERR! path E:\UOG\React_Native_Projects\MyFirstApp
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c react-native init AwesomeProject
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Muhammad Suleman\AppData\Local\npm-cache\_logs\2021-01-23T09_10_07_360Z-debug.log
Run this command
npm install -g react-native-cli
after that just add your npm path to your system variables in environment variables
C:\Users\YOUR USERNAME\AppData\Roaming\npm
I also have this problem. It got fixed by first typing following command:
npm i react-native
then:
yarn react-native init AwesomeProject
and it worked!!

I can't install anything with npm command line

I have been using npm for some time with ionic. Recently, it started giving an error when trying to install anything both packages and modules. Even with react native it gives the same error.
I have tried re-installing it, but that didn't fix it. I created a new user on my Windows system, but it's still not working, and I noticed that when I search for the error code on Google, I get no results.
C:\WINDOWS\system32>npm install -g ionic
npm ERR! error:0909006C:PEM routines:get_name:no start line
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\OLAMIDE AWOBUSUYI\AppData\Roaming\npm-cache_logs\2019-07-11T19_47_18_673Z-debug.logenter image description here
Try to set the npm registry:
npm set registry http://registry.npmjs.org/

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;
Install Node.js
Download Expo client at mobile device
npm install -g create-react-native-app
cd to my desired directory
create-react-native-app some_app_name
cd to my app folder containing default app.js
npm start
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! demo_app#0.1.0 start: react-native-scripts start
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the demo_app#0.1.0 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?
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?
Seems like this might be a duplicate of:
sh: react-scripts: command not found after running npm start