Is react-navigation incompatible with react-native 0.57? - android

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

Related

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

the development server returned response error code 500 - react native - ./configs/main

I got this error when i tried to make hello-world sample:
react-native init hello_world
cd hello_world
react-native run-android
Even when I ran:
npm install -g react-native-git-upgrade
react-native-git-upgrade
I got same error on commend line console.
I've searched and tried many solutions but it doesn't seem to work:
Example:
* upgrade react-native
* using watchman watchman watch-del-all
* remove node_modules
* clean cache npm cache cleanor npm start -- --reset-cache
Operation: Window 8
react-native-cli: 2.0.1
react-native: 0.44.2 ( tried 0.47.1 too )
Android: Simulator Nexus5X
Thank you all in advance!
Delete babel-preset-react-native folder inside node_modules and then install older version 2.1.0 of this library with npm install babel-preset-react-native#2.1.0 --save-dev.
In case if someone is using react-native: 0.57.1 or the latest one,babel-preset-react-native has been replaced by metro-react-native-babel-preset. if you still get 500 error while connecting to the device do the below step and I guess things will be fine
npm add #babel/runtime
npm install
Downgrade the following:
react-native init Project
cd Project
npm uninstall react-native
npm install --save react-native#0.55.4
npm uninstall --save babel-preset-react-native
npm install --save babel-preset-react-native#4.0.0
react-native run-android
For me it's about the react native version. I just install the new version of react native "0.59.2" then i downgrade to previous version to "0.55.2", and everything works fine.

How do I create a React Native project using Yarn?

I am running the following commands in the DOS console on a Windows 7 (64-bit) machine.
npm install -g yarn
yarn add global react-native
yarn add global react-native-cli
react-native init sample
After running react-native init sample, the console was closed.
The error log shows:
D:\Mobile>"$basedir/../../Users/pramaswamy/AppData/Local/Yarn/.global/node_modules/.bin/react-native.cmd" "$#"
D:\Mobile>exit $?
I think you're adding global dependencies wrong, and you shouldn't need to install react-native, globally or locally. react-native init will create a package.json with react-native listed as a dependency.
You should be able to install react-native-cli globally with yarn global add react-native-cli, not yarn add global react-native-cli.
Here yarn run android command will be used to run the react native app using yarn package manager, and yarn start will start the node JS server.
You should be fine with running the following:
npm install -g yarn
yarn global add react-native-cli
react-native init sample
yarn run android
yarn start
NEW SEP 2019,
now it's more simple, use node10 and expo: (easy way)
npm install -g expo-cli
*to create project:
expo init AwesomeProject
cd AwesomeProject
npm start
*install the app 'expo' on your phone, and scan the qr code for the project and you can start to view your app
more info:
https://facebook.github.io/react-native/docs/getting-started.html
UPDATE OCT 2018 Create React Native App (now discontinued) has been merged with Expo CLI
You can now use expo init to create your project. See Quick Start in
the Expo documentation for instructions on getting started using Expo
CLI.
Unfortunately, react-native-cli is outdated. Starting 13 March 2017, use create-react-native-app instead. Moreover, you shouldn't install Yarn with NPM. Instead, use one of the methods on the yarn installation page.
1. Install yarn
Via NPM. According to its installation docs, you shouldn't install yarn via npm, but if necessary, you can still install it with a pre-v5 version of npm.
UPDATE 2018 - OCTOBER
Node 8.12.0 and NPM 6.4.1 is already compatible with create-react-native-app. Really some minors previous versions too. You don't need more downgrade your npm.
On Ubuntu.
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
On macOS, use Homebrew or MacPorts.
brew install yarn
sudo port install yarn
2. Install the Create React Native App
yarn global add create-react-native-app
3. Update your shell environment
source ~/.bashrc
4. Create a React native project
create-react-native-app myreactproj
You got the order wrong. You should be
yarn add global react-native-cli
yarn add react-native
react-native init sample
Please You visit Bug
yarn global add react-native-cli
with
react-native --version
and I get "$basedir/../../Users/juvasquezg/AppData/Local/Yarn/config/global/node_modules/.bin/react-native.cmd" "$#"
the system cannot find the path specified
Go to C:\Program Files\nodejs and I saw:
react-native
react-native.cmd
react-native.cmd.cmd
The fix is to delete react-native.cmd and rename react-native.cmd.cmd to react-native.cmd
The Solution #1324 (comment)
You could also do
yarn dlx expo-cli
then:
expo init project_name
and follow the instructions
after finishing cd project_name and try
yarn web
It is now:
yarn dlx create-react-native-app
then follow the instructions.
cd project_name into the project folder and do:
yarn install
then try with:
yarn web
If you want to create app using yarn instead of npx;
yarn dlx react-native init ExampleApp this command will be helpful.
According to the react native documentation we should use npx react-native init AwesomeProject command
For more info about "yarn dlx": https://yarnpkg.com/cli/dlx
Yarn global is deprecated. If you run yarn global you will get an error.
Usage Error: The 'yarn global' commands have been removed in 2.x -
consider using 'yarn dlx' or a third-party plugin instead
But yarn dlx won't work like yarn global or npm install <module> --global

React native command not found

I am starting to install react native. I had successfully installed homebrew, nodejs , npm. but not able to install react native
First I had tried
npm install -g react-native-cli
gives me write warning:
Missing write access to /Users/project/.npm-packages/lib/node_modules/react-native-cli
After that I had tried
sudo npm install -g react-native-cli
/Users/project/.npm-packages/bin/react-native -> /Users/project/.npm-packages/lib/node_modules/react-native-cli/index.js
/Users/project/.npm-packages/lib
└── react-native-cli#1.0.0
Looks like install.
After that I tried
react-native init AwesomeProject
Error : react-native: command not found
What could be the problem
First of all, you have to install react native globally
npm install -g react-native-cli
then it will show you the path for the react native like the following
/Users/{yourUser}/.npm-packages/bin/react-native -> /Users/{yourUser}/.npm-packages/lib/node_modules/react-native-cli/index.js
Then you have to set the default path from the above result and execute the following command
export PATH="/Users/{yourUser}/.npm-packages/bin/:$PATH"
Then reload you session/env vairables
source ~/.bash_profile
It will work like charm!
Make sure that /usr/local/share/npm/bin is in your PATH to use binaries installed with npm
Add the following line to your ~/.bashrc
export PATH="/usr/local/share/npm/bin:$PATH"
Then reload your shell session and try that again
sudo yarn global add expo-cli
sudo yarn global add react-native-cli
You must use sudo here.
when you are using the latest version of node js and others related to react native
they updated to run react native app
npx react-native run-android
npx react-native run-ios
You can check Here

Categories

Resources