Can't install react-native-cli after following tutorial - android

Before reading and following the tutorial in NPM I installed the react-native-cli globally and it worked just fine
But in the tutorial it asks you to install sinopia
https://www.npmjs.com/package/react-native-cli
Then it gives you these instructions
react-native$ npm set registry http://localhost:4873/
react-native$ npm adduser --registry http://localhost:4873/
# Check that it worked:
react-native$ npm config list
react-native$ npm unpublish --force
react-native$ npm publish
react-native$ cd react-native-cli/
react-native-cli$ npm unpublish --force
react-native-cli$ npm publish
But the unpublish part gave me an error. the same for the 'publish' aprt.
(By the way, publish what?!)
Then it says to uninstall react-native-cli
npm uninstall -g react-native-cli
After that I couldn't reinstall react-native-cli.
It says the package is not available.
npm ERR! 404 no such package available : react-native-cli
npm ERR! 404
npm ERR! 404 'react-native-cli' is not in the npm registry.
What is this?! How can I fix it?
#edit
By the way, I don't understand why, in the Get Started tutorial it doesn't tell us how to install the react-native-cli nor gives us a link. It just states:
The React Native CLI #
Node.js comes with npm, which lets you install the React Native command line interface.
#edit2
I just managed to install react-native-cli by removing the 'registry' entry from npm config, installing it and adding Sinopia again.
I thought Sinopia worked as a proxy. If it is not found in local repository, it looks for it in NPMJS...
I even tried to install other things and I could (wdio, nodemon), I just got an error with react-native-cli.
It seems that something is wrong.

Seems like you on Windows
I don't think you need sinopia.
Tutorials was little improved on master branch of the docs: http://facebook.github.io/react-native/releases/next/docs/getting-started.html
In short:
Install node.js
Install react-native-cli: npm install react-native-cli
Install & setup Android SDK
Create & run project
react-native init AwesomeProject
cd AwesomeProject
react-native start
react-native run-android

Related

React Navigation Error on npm install

I'm trying to create a new react native app with react navigation.
I did the following:
1.) create-react-native-app myAppName
2.) cd myAppName/
3.) npm install --save react-navigation
4.) Expecting successful installation of react-navigation but instead i get:
C:\Users\Maima\Documents\GitHub\React\test>npm install --save react-navigation
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\semver
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\semver
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-navigation#1.0.0-beta.23 requires a peer of react#* but none is i
nstalled. You must install peer dependencies yourself.
npm WARN react-navigation#1.0.0-beta.23 requires a peer of react-native#* but no
ne is installed. You must install peer dependencies yourself.
npm WARN react-native-tab-view#0.0.74 requires a peer of react#* but none is ins
talled. You must install peer dependencies yourself.
npm WARN react-native-tab-view#0.0.74 requires a peer of react-native#* but none
is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout-polyfill#1.3.2 requires a peer of react-nati
ve#* but none is installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout#1.3.2 requires a peer of react#* but none is
installed. You must install peer dependencies yourself.
npm WARN react-native-drawer-layout#1.3.2 requires a peer of react-native#* but
none is installed. You must install peer dependencies yourself.
+ react-navigation#1.0.0-beta.23
added 8 packages, removed 973 packages and updated 20 packages in 259.667s
Please Help, Cant npm start my React Native App.
It can be solved by running a npm install command again and reinstall the npm install --save react-navigation command.
I cant comment because I dont have the points, so heres a tentative answer with the info at the moment:
I had similar issue when running Expo on Windows. to solve I had to close XDE and reinstall.
if that's not enough, delete the "node_modules" folder and run "npm install".
They aren't errors, just warnings telling you that some peer dependencies that navigation relies on aren't installed. Based on your commands, you need to run npm install or yarn install to install all the packages. Creating the app with create-react-native app give you a list of packages but you have to actually install them with npm install. If something funky happens, do what #vbandrade suggested and hose your node_modules and package.lock, then do a fresh npm install
The same error appeared when I tried to run npm install --save react-navigation. Turns out I needed to run npm install prior to npm install --save react-navigation.
Followed the steps but got error with npm install. I am also using Expo (as mentioned by #vbandrade) and there are also problems with that. First of all, i think react-navigation is changing a lot. After trying a lot (before applying the solution in the accepted answer), i installed react-navigation and its dependencies multiple times and it worked at one time when i first ran;
npm install react-navigation
then
npm install #react-navigation/native
(which doesn't make too sense for me as that gets auto installed with react-navigation). Then i ran;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
for installing dependencies and it worked. Honestly i didn't understood anything that how it worked. So for the sake of learning i installed the project and reinstalled it with expo and after that nothing worked. So i applied #vbandrade's answer but it was giving some more errors after i ran npm install.
To get rid of these errors, i found another solution (from stackoverflow). Here is that solution.First of all delete node_modules folder and package-lock.json file and close your editor or any other file where your project is open (because node doesn't install some packages if the project is open).
Then,
First run this command;
npm cache clean --force
Then,
npm install
And then;
npm install react-navigation
And at last install the dependencies;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
Run your project;
If using expo;
expo start
Errors must be gone now.
If you are running your expo server, stop the server and continue npm install --save react-navigation . It worked for me.

installing npm modules removes react-native-cli

I have a react-native project where I install modules using
npm install some-module -save
package.json includes react-native-cli
Now, every time I do this the command react-native run-android is not available anymore. I have to run
yarn add react-native-cli
in order for it to be available again. Also, the gradle file of some modules get out of sync when I do this which means running Android Studio and updating these.
I find this very confusing. Earlier in the project, I was only using npm and had no problems.
i think you can try this
npm install -g <package> --save

npm WARN react-native-maps#0.14.0 requires a peer of react#>=15.4.0 but none was installed

Problem
I'm trying to install react-native-maps by Airbnb in my project. Installation instructions:
airbnb/react-native-maps/installation
When I run the following command in cmd: npm install react-native-maps --save
This is what I get:
`-- react-native-maps#0.14.0
npm WARN react-native-maps#0.14.0 requires a peer of react#>=15.4.0 but none was installed.
Ignoring this if I proceed with further installation, and run the following command: react-native link react-native-maps
This is what I get:
Scanning 561 folders for symlinks in C:\RNProjects\Mapp\node_modules (39ms)
rnpm-install info Linking react-native-maps ios dependency
rnpm-install info iOS module react-native-maps has been successfully linked
^As we can see, only iOS related maps modules get installed. On checking the project directory, I was able to validate that no android related module was installed.
Troubleshooting
Here's the list of thing I tried to resolve the issue, but none of them worked.
Tried installing npm install react#15.4.0 --save
Got these warnings:
npm WARN react-native#0.43.3 requires a peer of react#16.0.0-alpha.6 but none was installed.
npm WARN react-test-renderer#16.0.0-alpha.6 requires a peer of react#^16.0.0-alpha.6 but none was installed.
So, in order to resolve this, I tried installing react#16.0.0-alpha.6 with: npm install react#16.0.0-alpha.6.
I got the same message again:
npm WARN react-native-maps#0.14.0 requires a peer of react#>=15.4.0 but none was installed.
Tried updating react-native npm update react-native.
Still getting the same warning message.
Tried installing the latest version of npm: npm install npm#latest -g.
Didn't work.
Additional Information
react-native: 0.43.3
react-native-cli: 2.0.1
Platform: Android
Development Operating System: Windows 10 OS
Here's how I was able to solve this (chronological order):
Deleted node_module directory from the project
npm cache clean
Modified package.json with: "react":"~15.4.1"; "react-native":"0.42.3"; "react-test-renderer":"15.4.1"
npm install all module
npm install
npm i react-native-maps#0.12.5 --S
react-native link react-native-maps
Once I do this, it's successfully able to link the android and ios react-native-modules to the project.
Note: Before running the react-native run-android command,
Run: cd android && gradlew clean && cd .. && react-native run-android.
This will clean the gradle before running and help in avoiding any errors.
You can try:
delete node_module, npm cache clean;
modify package.json
"react": "~15.4.1","react-native": "0.42.3","react-test-renderer": "~15.4.1",
npm install all module;
done ;)
Here is how i was able to solve this same issue:
I deleted the node_module folder (You can verify npm cache: npm cache verify)
I actually changed the package.json file to the following:
"react": "~15.4.1","react-native": "0.42.3","react-test-renderer": "~15.4.1"
But that triggered other error on my side; So i put them back to their initial
values:
a. "react": "17.0.1",
b. "react-native": "0.64.0",
c. "react-test-renderer": "17.0.1"
npm install all module
npm install
npm audit fix --force
npm i react-native-maps#0.12.5 --S
react-native link react-native-maps
At this point I opened 2 terminals:
a. Terminal 1: react-native start
b. Terminal 2: react-native run-android or yarn android

react-native: command not found

I am getting -bash: react-native: command not found error while creating a react-native project.
Below are the additional info
1. brew --version
homebrew 0.9.9
2 brew info watchman
watchman `enter code here`stable 4.50
/usr/local/Cellar/watchman/4.4.0
3. brew info flow
stable 0.24.1
/usr/local/Cellar/flow/0.24.1
4. brew info node
stable 6.1.0
/usr/local/Cellar/node/6.1.0
5. npm -version
3.8.6
6. echo $PATH
/Users/Ashok/.rbenv/shims:/Users/Ashok/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I tried the suggested steps from this link but I am still getting the same error.
I don't have any "npm" directory which they have specified in the solution
Ashoks-MacBook-Pro:share Ashok$ ls
aclocal doc info ruby-build zsh
autoconf emacs man systemtap
But I found npm file exists in the below location.
/usr/local/Cellar/node/6.1.0/etc/bash_completion.d
I uninstalled react-native and installed it again but I am still facing the same issue.
After adding right path to the PATH variable issue is resolved.
Below are the steps to find the right path.
1. Enter: npm install -g react-native-cli
output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib
└── react-native-cli#0.2.0
from above output you can clearly see the path: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native
export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"
react-native init appName
cd appName
react-native run-ios
if you getting xcrun: error: unable to find utility "simctl" at this stage you can reslove using below steps
XCode -> Preferences -> Locations -> Command Line Tools -> Choose Xcode 7.2.1
You can find original solution from xcrun unable to find simctl
Thanks to #fbozo
That's It!!!
run this code
npm i -g react-native-cli
close your cmd and open it again
After continually running into this problem, and hitting this answer and not having it work..
Assuming you don't run npm as root/sudo (which you shouldn't do!) your npm modules will be installed in whatever you set your default directory to be.
Assuming you have followed those instructions, and your default directory is ~/.npm-global, then you need to add ~/.npm-global/bin to your path.
This is outlined in those instructions, but for me I added this to .bashrc:
export PATH=$PATH:$HOME/.npm-global/bin
Then restart your shell and it will work.
Try
npx react-native
if doesn't work install globally
npm i -g react-native-cli
If who have error , try it with sudo:
sudo npm install -g react-native-cli
If you're using yarn, you may have to run commands with yarn in front. Example:
yarn react-native info
I ran into this issue by being a bit silly. I use nvm to manage my different versions of node, and installed react-native into a version of node that was not my default. Upon opening a new shell, I lost my command. :) Switching back of course fixed things.
If for some strange reasons, the path to react-native is not in the PATH, you should take note where the react-native executable is installed. Generally, the issue with command not found is because they are not in PATH.
For example, I use nodenv and run npm install -g react-native
/Users/khoa/.nodenv/versions/10.10.0/bin/react-native -> /Users/khoa/.nodenv/versions/10.10.0/lib/node_modules/react-native/local-cli/wrong-react-native.js
So I need to add that to my PATH
export PATH=$HOME/.nodenv/versions/10.10.0/bin:$PATH
You can verify with echo $PATH
Or you can use npx to execute local npm modules, for example
npx react-native run-ios --simulator='iPhone X'
Install react-native globally by using the following command
npm i -g react-native-cli
Had the same issue but half of your approach didn't work for me .
i took the path the way you did :from the output of react-native-cli instal but then manually wrote in ect/pathes with:
sudo nano /etc/paths
at the end i've added the path from output then ctrl x and y to save .
Only this way worked but big thanks for the clue!
Install react-native-cli with npm install -g react-native-cli.
You may need to use sudo like sudo npm install -g react-native-cli
At first run this command on your terminal.
npm i -g react-native-cli
Then create your react-native project by this command.
React-native init Project name
then move to your project directory by cd command.
According to official documentation, the following command worked for me.
npx react-native run-android
Link is here
https://facebook.github.io/react-native/docs/getting-started
I was trying to run by "react-native run-android" command. make sure to have react-native cli installed globally!
In case anyone has this problem, I had a similar problem to qix, but more nuanced.
New shell terminals would default to a different version of node.
I would change my terminal to the node I wanted, but when the bundle script run, it ran in a new shell, and it got the default version which did not have react-native installed.
I used nvm alias default x.x.x so that new shells would inherit the default version I wanted.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install yarn
brew install node
brew install watchman
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
npm install -g react-native-cli
Dears,
Please try : npm install -g react-native-cli
If you get an error like Cannot find module ‘npmlog’ you can install npm directly using this command. If the above command run successfully then no need to run this command
curl -0 -L https://npmjs.org/install.sh | sudo sh
#For_Ubuntu.
Best regards.
In cmd Administration mode,Run
npm install react-native-cli
This is really weird, on my side (macOS 10.14), i'm pretty sure my node and npm work but i kept getting command not found only for this particular package. I ended up doing the following:
Install react-native-debugger
Make sure you enabled remote JS debugging, docs
Run react-native-debugger
Run your RN app
You can now debug view hierarchy and see console logs in react-native-debugger
I already had react-native and react-native-cli installed and just had to run:
yarn install
I had this issue after ejecting from expo and forgot to delete the node_modules and reinstall by running yarn or npm install.
After I did that then run npx react-native run-android, it worked fine!
try using react-native --help and see what comes up. try curl
react native library recommendation:
If you get an error like Cannot find module 'npmlog', try installing npm directly: curl -0 -L https://npmjs.org/install.sh | sudo sh.
https://facebook.github.io/react-native/docs/getting-started.html
I did an npm update, runned into the same error but after do an npm install and re-build the app worked!

installing ionic npm ERR! tar.unpack error

while installing ionic npm install -g ionic getting error.
Have tried : -
npm cache clean 2. run the cli by administrator 3. restarted the system but error remain same.
Badly stocked.
I was having same problem on Windows 8 (64 bit)
Solution:
Don't forget to install other dependencies before installing ionic http://ionicframework.com/docs/guide/installation.html
1) Uninstall Node from Control Panel
2) Restart PC
3) Download (MSI Installer) older version of Node from http://nodejs.org/dist/v0.10.38/ or 64bit http://nodejs.org/dist/v0.10.38/x64/
4) Install Node version 0.10.38
5) npm install -g cordova
6) npm install -g ionic
Done!
it is not nessesary to uninstall node...
just remove the old npm ionic folder
...AppData\Roaming\npm\node_modules\ionic
and try again
npm install -g ionic
For me the answers provided did not work. I got around this problem by installing cordova and ionic at the same time.
npm install -g cordova ionic
If proxy is preventing this, other things to try are setting the proxy, making http request and disabling strict-ssl. An example of setting proxy is
npm config set proxy=http://username:password#domain:port/
To make http request only change the config
npm config set registry=http://registry.npmjs.org/
To disable strict-ssl
npm config set strict-ssl=false
Also, if you wanted to view the default list of configs type
npm config ls -l
This will also show what configurations have been overridden.
Uninstall Node.js and install freshly after done installation run the following command
npm install -g ionic cordova
That's it.

Categories

Resources