Why am I unable to install expo cli? - react-native

I have followed the documentation from Expo website, installed NodeJs, git, watachmann, however I m still getting errors when installing Expo cli:

First, ensure you use the recommended version of nodejs. For that, you can use the n module:
// if you haven't installed it before
sudo npm install n -g
//to have the latest stable version
sudo n stable
Then delete all your preview installs with npm and start over. For expo-cli:
sudo npm uninstall --global expo-cli
sudo npm install --global expo-cli

Related

How can I install a specific NativeScript version?

Im trying to install the tns 6.7.4 version, but I just get the 7.1.2 version.
I tried to do:
sudo npm uninstall -g nativescript
sudo npm cache clean --force
sudo npm install -g nativescript#6.7.4
I also tried with nativescript#6 and also with nativescript#6.7 but everything ends with the 7.1.2 version.
The command npm i -g nativescript will install the NativeScript CLI. It won't update/migrate your existing project. However, once you have installed a specific version of the CLI, you can use it to create new projects with the related versions.
For example
npm uninstall -g nativescript
npm i -g nativescript#5.4.0
tns --version // will output 5.4.0
Once you have the wanted version of the CLI you can create a project that uses the core dependencies

Cant Install expo cli

I'm trying to install Expo CLI for React Native
The latest version of Node js also installed
in command prompt, I typed npm install expo-cli --global
I'm getting error
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[..................] \ fetchMetadata: WARN deprecated request#2.88.2: request has been deprecated, see https://github.com
I also checked the GitHub issues/3142 but not found any solution
I was having the same issue install expo-cli with npm it gives WARN of request#2.88.2 deprecation, then what I did, simply install
npm install -g yarn
and after that
yarn global add expo-cli
and now it's successfully installed expo-cli, and I have the latest version of expo-cli as of today.
$ expo --version
3.15.4
It is not an error, it is just a warning so you should not worry. Everything seems fine. You can check your expo-cli installation within below command:
$ expo --version
2.21.2
By the way you don't have to install expo-cli at all. You can use npx expo init to create a expo project.
I had the same problem and it turned out my version of NodeJs was not supported. The documentation states that you need Node.js LTS release or greater.
This is the output when I attempted to install expo-cli then ran expo --version
Output:
ERROR: Node.js v12.10.0 is no longer supported.
expo-cli supports following Node.js versions:
* >=10.13.0 <11.0.0 (Maintenance LTS)
* >=12.13.0 <13.0.0 (Active LTS)
* >=14.0.0 <15.0.0 (Current Release)
I solved it by updating nodejs and reinstalled expo-cli with npm i --global expo-cli and it worked.

Expo cli update not happening

I am trying to upgrade expo-cli from 2.11 to 2.18 but npm i -g expo-cli#latest still points to the old version.
when I typed expo-cli -V it resulted:
2.11 ...so naturally npm i -g expo-cli#latest will grab the latest version and install it but still expo-cli -v is still pointing to the old version.
I remember installing packages in bash level is a no go operation.
these are some images to put it all into context:
Update: Removed Nodes modules as suggested in the first answer, and that lead to npm removal both expo and expo-cli are not found with the command where
For mac users (linux should be very similar):
Find your expo-cli version:
which expo-cli
For me it yielded:
/Users/username/.config/yarn/global/node_modules/.bin/expo-cli
Remove this outdated version:
rm -rf /Users/username/.config/yarn/global/node_modules/.bin/expo-cli
Check that you are using the latest version:
expo-cli --version
Updating expo-cli globally can be a right pain. To those experiencing this frustration, use yarn
yarn global add expo-cli
it will give you far fewer headaches
On MacOS (Linux should be very similar):
Find the location of the expo-cli version:
which expo-cli
You would probably get:
/usr/local/bin/expo-cli
Remove this outdated version by using:
rm -rf /usr/local/bin/expo-cli
Then install the latest version:
npm install -g expo-cli
After that, check that you are using the latest version:
expo-cli --version
If you're like me, and none of this stuff worked, maybe my solution will help.
My problem is that I switched from NPM, to Yarn at some point, and I had global packages in both systems, which was giving me a bunch of trouble.
Step 1: Make sure you don't have expo-cli in global npm
npm list-g
Step 2: If it is in global npm, uninstall it
npm uninstall --global expo-cli
Step 3: Install it fresh with yarn
yarn global add expo-cli
Step 4: Stop using npm for global packages (or at least, only use one system)
edit: spelling
If you are using a Mac, these 2 commands will do the tricks
1)which expo to locate expo in your Mac which will give you this "/usr/local/bin/expo"
2) "cd /usr/local/bin/"
3)-rm expo
4)-rm expo-cli
the hole system was behaving oddly!, npm should've been installed with node but it was nowhere to be found.
I had to remove node and reinstall it again, then I had to install expo-cli again and all errors went away.
When npm does not work in an easy way, --force it!
npm install -g expo-cli --force
Update to the latest version of Expo CLI:
npm i -g expo-cli. expo-cli#4.7.2 or greater is required.
Update to the latest version of EAS CLI if you use it:
npm i -g eas-cli.
Run expo upgrade in your project directory.
Reference: https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough/
there is more than a reason for not updating the expo-cli.
reason 1 - you maybe installed expo-cli using yarn and after a while you need to update and using npm npm install -g expo-cli it will update but maybe when you run expo its point to that yarn version so to resolve this you need to run yarn global remove expo-cli.
reason 2 - it might you have two versions of expo-cli one its global version and one inside your project folder/path, so even you upgrade expo-cli globally, your project still point to the first class version which is in your project folder. to resolve this you need to uninstall expo-cli which exists in your project folder to point to the global version and you can do this using this command npm uninstall expo-cli notice without -g.
reson 3 - sometimes you need to clean npm cache. if nothing works for you above try to uninstall expo-cli using npm uninstall -g expo-cli and then run this command npm cache clean --force then install expo-cli again npm install -g expo-cli.
expo-cli --version
npm uninstall expo-cli
npm install -g expo-cli
expo-cli --version
if cannot, you can update manually
check path
npm bin -g
change "node_modules" folder or remove
C:\Users{username}.npm-global\node_modules
npm install -g expo-cli
copy\past expo-cli folder
from C:\Users{username}.npm-global\node_modules\expo-cli
to C:\Users{username}\AppData\Roaming\npm\node_modules\expo-cli
expo-cli --version

Uninstalling Expo CLI

I have installed Expo CLI globally and cant start a new react native app without using expo cli and therefore would like to uninstall it from my system. I have spent hours trying to work out how to removeit globally from my system
To completely uninstall expo cli
On Windows
The first step npm -g uninstall expo-cli --save (also yarn global remove expo-cli if you use yarn).
Second cd %USERPROFILE% && rmdir /Q /S .expo
On Mac OS Catalina
The first step npm -g uninstall expo-cli --save (also yarn global remove expo-cli if you use yarn).
Second cd ~ && rm -rf .expo
Thanks to #Александр Наумкин and #Liko for editing and comments
npm -g uninstall expo-cli --save did not work for me, but yarn global remove expo-cli did.
I expected the npm option to work, and was surprised when it didn't. I am using nvm, and wonder if this answer explains why the npm option didn't work for me.
I had the same problem and after searching I found this command:
npm -g uninstall expo-cli --save
finally expo-cli is deleted from my pc but it still asks about it every time I type create-react-native-app. if anybody knows how to go on from here be my guest.
and I hope this helps you
edit: if you use react-native init it is almost the same as create-react-native-app without expo-cli. This is how I chose to carry on as using the create command with expo-cli gives the application error after error if you install any api.
if you are using npm then this command will work for uninstalling expo cli
npm -g uninstall expo-cli --save
I had the same problem once, i have tried
npm -g uninstall expo-cli
but after the my problem didn't get solved, i have searched lot even after that problem did't get solved,
i am also using yarn so finally i have decided to remove using the yarn
i tried
yarn global remove expo-cli
This indeed solved my issue
If you are using nvm.
search for node version with expo installed.
find ~/.nvm -name "*expo*" -type d
nvm use {nodeversion}
npm -g uninstall expo-cli
If yarn don't work for you or you prefer using npm use:
npm rm -g expo cli
Very simple to uninstall a npm package.
Just enter this command :
npm uninstall -g expo-cli
In Windows 10 npm uninstall -g expo-cli --save worked for me from nodejs console, opening it as administrator
In windows 10 to uninstall :
npm uninstall -g expo-cli --save
yarn remove global expo-cli
Worked for me.
After that, for install last version then:
npm install -g expo-cli --save
expo-cli --version
3.21.13
I had this issue.
My steps
npm cache clean --force
npx install create-react-native-app
cd
npm install -g expo-cli
expo start
If you get error at 4 about node.js just install latest version. Then
Open your package.json file and add:
"react-navigation": "git://github.com/Snailapp/react-navigation.git#2.18.5"
npm install
Ok, in addition to existing answers, with commands like npm -g uninstall expo-cli and deleting manually .expo folder inside %USER% i try expo whoami, and my output was:
$ expo whoami
There is a new version of expo-cli available (4.13.0).
You are currently using expo-cli 3.23.3
Install expo-cli globally using the package manager of your choice;
for example: npm install -g expo-cli to get the latest version
[13:13:03] › Not logged in, run expo login to authenticate
So i had to do a bit more manual work:
%USER%\AppData\local and deleted expo folder
went to %USER%\AppData\Roaming\npm folder and manually deleted expo related files
After that i did expo whoami and output is:
$ expo whoami
bash: /c/Users/User/AppData/Roaming/npm/expo: No such file or directory
Finally, i opened new command prompt and did npm i --g expo-cli and after installation with expo -V i get 4.13.0.
I had the same issue
i unistalled using
npm uninstall expo-cli
or
npm unistall -g expo-cli

Unable to link react-native-version-number

I am trying to install react-native-version-number. The instructions state that after installing, issue;
react-native link react-native-version-number
but when I do this, I get the following error message;
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
but when I run
npm uninstall -g react-native
I get
npm WARN uninstall not installed in /usr/local/lib/node_modules: "react-native"
How do I link react-native-version-number?
As a workaround, dv3's comment about using rnpm link did work. However, I found that I was having this problem with other react-native commands, such as react-native run-android. This appears to be because npm was installed using homebrew. A description of this problem and how to fix it can be found at on this gist. In summary the required fix is to uninstall all your npm globably installed packages, uninstall node, then reinstall node, and reinstall npm without brew.
npm list -g --depth=0 # to list all your globally installed packages
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
and then, you have to reinstall all your npm packages that were installed globally.