react-native link realm fails - android

I'm trying to get started working with react-native and I want to use realm as well. This is a brand new project here are my steps:
$ react-native init BibleBinderRN
$ cd BibleBinderRN/
$ react-native -v
At this point I see:
react-native-cli: 2.0.1
react-native: 0.45.1
Next:
$ npm install --save realm
$ react-native -v
Result:
react-native-cli: 2.0.1
react-native: n/a - not inside a React Native project directory
I don't understand why this is not an RN project directory at this point. Can anyone help?

I'm relatively new on React Native however I got the same error the last days.
Indeed, when I installed different plugins with the command npm install blabla --save, just after I wasn't able to run command such as react-native link ... or even react-native run-android
After reading different topics, the solution I found was to do it with yarn. Indeed, with the command yarn add blabla it works perfectly. Some explanations I have found on github was about a problem of npm versions.
However, if you found a solution, I'm interest in !

First run:
npx react-native init name-project
Then install Realm:
npm install realm
Do not use CLI globally
https://reactnative.dev/docs/_getting-started-linux-android#installing-dependencies

The previous comments do not mention how you correctly connect a setup react-native project with realm. This is not trivial! You'll find fast steps to setup a react-native app connected to realm here: How do you setup Realm with React Native?
This will result in an example app which you can use as help to implement your own functionality.

Related

Specify configs in the ini-formatted file:

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

Is react-navigation incompatible with react-native 0.57?

i'm new to react-native, npm, etc ..
But I can follow some samples an run some test of a android app.
Now I want to learn navigation.
I follow steps in https://facebook.github.io/react-native/docs/navigation ...
But after I install react-navigation, I can't use anymore "react-native run-android" command...
C:\Users\Nicolas\react-native-app\KleinProject>react-native run-android
Command `run-android` unrecognized. Make sure that you have run `npm install` and that you are inside a react-native project.
What is wrong? npm ? react-native ?
I read somewhere that react-navigation work with react-native <=0.51
Mi version are:
SO: Win 10
npm: 6.4.1
react-native: 0.57
How can I use react-navigation, in react-native ?
Best Regards
install nodejs
install react-native-cli
npm i -g react-native-cli
create a project using "react-native" <- i think you didn't do this
react-native init projectname
install react-navigation using
cd project/folder
npm i react-navigation

error on react-native run-android while installation , can't run in windows 10

I am currently running Windows 10. I followed all the steps on the documentation regarding android development on https://facebook.github.io/react-native/docs/getting-started but got the following error:
I tried uninstalling and cleaning my installation directories twice, but still it has the same error.
I really want to setup my development environment for React Native, but I don't know what action to do next.
The versions I'm using (latest):
react-native-cli: 2.0.1
react-native: 0.56.0
Any help would be greatly appreciated. Thanks!
EDIT - here's the output of react-native start
I think this is a bug in version 0.56. The "solution" is to find the correct combination of dependencies' versions.
Try this commands one by one correctly ...
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
npm uninstall react-native
npm install --save react-native#0.55.4
react-native run-android
npm install --save babel-core#latest babel-loader#latest
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native#4.0.0
react-native run-android

How to initialize React Native project

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

React-Native run-android command issue

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

Categories

Resources