Noob here,
Im trying to run android emulator installed for my reactnative app to test on vscode online on azure linux machine and getting the follow error:
Specify configs in the ini-formatted file:
/home/vsonline/.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config
when I run npm start-android-emulator I get the error.
Please any help. I am trying to run react-native code without installing android studio
you should use npx or yarn like this npx start-android-emulator or yarn start-android-emulator
Related
Hello friends pls I have been stuck on this 😔 error for the past weeks I'm trying to run a React native cli project on my Windows laptop and after following the documentation on the official create React native website I still get this error I have already downloaded and installed my android studio and my virtual device is up and running but for some reason I whenever I try to run "npx react-native run-android " after a while this error shows up
This my first working on a React native cli project
I ran npx react-native init app3
And
I have configured my Path and Android_Home environment variables as you can see it's still showing on my command prompt and powershell
I'm using a
Node version 16.13.0
Npm version 8.1.0
Javac version 17.0.1
And I'm relatively new to mobile development
Is used the the
Echo %ANDROID_HOME%
echo %PATH%
Command to check the Android_Home And Path location on my system
And it was as follows
C:\Users\andre\AppData\Local\Android\Sdk
C:\Users\andre\AppData\Local\Android\Sdk\platform-tools
Please note I have read the documentation and I'm referencing the point where the error happens as well as the steps I have taken. Please don't advice me to follow the instructions that I have already indicated I have followed.
After following the documentation of React Native to the best of my ability, I have been unable to get React Native to run. I have installed jdk, node, and Android Studio as instructed (using Chocolatey and links). The Android Emulator runs from Android Studio. I'm using npm version 6.1.0, node version 8.4.0, jdk 8, Android Studio 3.1.3. The error I get after react-native init AwesomeProject is SyntaxError: Unexpected token import. What did I do wrong? How can I fix this? Running react-native run-android also gives the same error.
To be clear, I'm in the proper directory. ANDROID_HOME is set to the proper sdk folder. There is a heading, Running your React Native application, and running the first command leaves me with the error, but I don't get an error before that point.
install npm
install react native cli => npm install -g
react-native-cli && npm install -g react-native (admin or sudo)
react-native init MyProject
cd Myproject
react-native run-ios or run-android
Update node to the latest version.
npm install -g react-native-cli.
npx react-native init newProject.
Since you install react native globally you don't need to use npx packages anymore just try
react-native init newProject
Assuming that you have Node 14 LTS or greater installed, you can use npm to install the Expo CLI command line utility:
npm install -g expo-cli
Then run the following commands to create a new React Native project called "AwesomeProject":
expo init AwesomeProject
cd AwesomeProject
npm start
Source: React Native Environment Setup
When starting android project with React-Native it is giving this error:
React-Native Command run-android unrecognized.Did you mean to run this inside a react-native project?
You can try to do npm install before react-native run-android
First we have to install react-native then upgrade packages if you need and run android.
npm install --save react-native#latest
react-native upgrade
react-native run-android
A lot of developers fail to mention the crucial point,that certain commands require you to be a particular directory. In this case, to "react-native run-android", you have to be in your project directory!
Command run-android unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
I faced this issue, the problem is we need to navigate to or project folder.
example: I created the project in "MyApps" with app name "DemoApp" in D drive
the command line root should be like this:
D:\MyApps\DemoApp>react-native run-android
now it will run with out any issue.
The problem is your android related info is presents inside the app not t=in the main directory.
I was facing the same problem and the above solutions did not work. Try using:
yarn add react-native-cli
First of all please see if devices/emulator is attached and working by following command
adb devices
there should be some devices showing connected
it is better to restart/reconnect you emulator/device and then try to run application again
if not working you can also try
npm install
You need to make sure that you are inside the project like cd AwesomeProject and do npm i and after that execute npx react-native run-android
In my case the problem was that I was in the android folder of my project due to this command cd android && ./gradlew assembleRelease.So the solution was to cd ../ and come to root of project and then running this command
react-native run-android --variant=release
ran fine.
For me the issue was I was not inside the project directory AwesomeProject( Project that I created using this command :
react-native init AwesomeProject )
I got it fixed after adding Android sdk-tools to PATH, and restarting VSCode/Terminal.
/Users/<username>/Library/Android/sdk/build-tools
Earlier my path set to
/Users/<username>/Library/Android/sdk
1.make sure java jdk installed
2.make sure npm installed in your project root folder
3.this works for me
I am using this tutorial
https://facebook.github.io/react-native/docs/getting-started.html#content
I am using windows 8.
I have print npm install -g react-native-cli. Then
react-native init AwesomeProject
cd AwesomeProject
Then I have read that on windows I can't use this command react-native run-android so I print node node_modules/react-native/packager/packager.js
as suggested here https://facebook.github.io/react-native/docs/linux-windows-support.html#content
And I get the following output:
Error: Cannot find module
'C:\Windows\System32\AwesomeProject\node_modules\react
-native\packager\packager.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:136:18)
at node.js:972:3
Myawesomeproject folder has 2 files
npm-debug.log and package.json
So I feel like something went wrong. Ho can I fix this?
It seems like npm is not installed correctly on your machine. You may test it by calling npm install in the generated directory. If it runs successfully and the node_modules folder in that directory is filled your are good to go. You should then run the react-native init command again so it can generate everything correctly.
I am trying to run the phoneRTC demo, I hae build the android demo app and have a signalling server running but when I run the client app on android all I get is a blank screen.
these are the steps I have taken:
npm install -g cordova bower grunt-cli
git clone https://github.com/alongubkin/phonertc.git
ionic create phonertc-ionic
cp -R phonertc\demo\client\* phonertc-ionic\
cd phonertc-ionic
npm install
bower install
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
cordova plugin add https://github.com/alongubkin/phonertc.git
cordova platform add android
cd ../phonertc/demo/server
npm install
node index.js
change server details in phonertc-ionic/app/scripts/signaling.js to:
var socket = io.connect('http://my_server_ip:3000/');
and run the following in phonertc-ionic:
grunt build --force
cp -R app/* www/
cordova build android
My signalling server is running but when I try to hit the port via a browser I get the following message:
Error: ENOENT, stat '/home/server/index.html'
and when I run the app on my phone I just get a blank screen.
Am I doing something wrong?
I solved the problem, turns out there was a bug in the grunt version I was using, using an older version or manually adding the libraries instead of using grunt worked.