How do I properly install expo-cli with yarn? - node.js

I'm trying to install expo-cli.
When I use npm install -g expo-cli, it installs with the below output.
When I try to run the expo command I get an error that the system cannot find the path specified. I then uninstalled with npm uninstall -g expo-cli
I uninstalled node and npm and cleaned up my system, then I tried installing expo-cli with yarn global add expo-cli. It installed with the following output.
After this, expo init command worked. But when I run expo start in a project folder I get the below output.
I don't know what else to do. I'm on Windows 10.

For Yarn:
If you want to save expo-cli package globally then try
yarn global add expo-cli
and if you want expo-cli to be available in the folder in which you are currently working then use
yarn add expo-cli
For npm:
npm install expo-cli --global
or
npm install expo-cli

There's a similar issue reported here. You can try adding expo to your local project to see if that helps.
Try:
yarn add expo

npm cache clean -f
npm install -g n
sudo n stable

You want to save expo-cli package globally then try
yarn add global expo-cli

Related

Expo gets stuck during install with npm but installs with yarn and doesn't work

When I try installing expo using npm install -g expo-cli, it gets stuck for hours here - expo-cli error
npm WARN deprecated #hapi/joi#17.1.1: joi is leaving the #hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
[..................] \ fetchMetadata: WARN deprecated #hapi/joi#17.1.1: joi is leaving the #hapi organization and moving back to 'joi' (https://github.com/sideway/joi/
But when I use yarn to install expo, it says expo is installed successfully. But it doesn't work when I type expo --version or just expo in cmd.
I've tried changing the environment path
I've uninstalled and reinstalled node
I've tried npm cache clean --force
npm install --global expo-cli --force
That's what did it for me.
Same errors at the beginning of the installation attempt, but afterwards it ignored the issues and installed it anyways.
And it works just fine. Though, usually you should be careful with " --force".
I had this problem in Windows 10, to be able to install the latest version. I had to install the latest version of Python (3.8.0) and then run npm install --global --production windows-build-tools as an administrator, then I was able to run again: npm install expo-cli --global to install the version 3.8.0 of the expo-cli

Create React App not installing, showing an error and aborting installation

I Reinstalled Node.js and Yarn. Now I am getting this error.
My environment information is:
Node: v8.12.0
NPM: 6.4.1
Yarn: 1.10.1
OS: Windows 10
PS C:\Users\mdbel\Desktop\Project\redux> npx create-react-app learnredux
Creating a new React app in C:\Users\mdbel\Desktop\Project\redux\learnredux.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/#xtuc/long/-/long-4.2.1.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\mdbel\\Desktop\\Project\\redux\\learnredux\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\mdbel\Desktop\Project\redux\learnredux has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
Once you have cleaned the yarn cache by running:
yarn cache clean
then subsequent calls to:
npx create-react-app your-app
will work.
I had same issue and solved it by:
Installing latest version of node, npm and yarn.
npm install -g npm#latest
nvm install node
npm install -g yarn
nvm installs Node.js and npm manages packages.
I solved this problem by deleting .yarnrc file from C:\Users\yourUserName\
removing .npmrc from C:\Users\you\.npmrc can also solve the problem.
I had a same problem then i tried the below Command and it fixed my issue
npm cache clean --force
The above command didn't solved your problem then try the below one.
npm init -y
npx create-react-app your-app-name
updating to latest stable version of yarn and removing yarn cache folder in the AppData folder has solved my issue C:\Users\test\AppData\Local\Yarn
I faced the same issue when using npx and was able to resolve this with the following steps:
Upgraded to latest yarn version: $ npm i #yarn#latest
Remove node_modules folder
Remove yarn.lock (if it exists).
Remove .npmrc from your user folder.
If the issue still persist you can use yarn command instead : $ yarn create react-app learnredux
yarn create is available in Yarn 0.25+
I had the same error on my Mac.
I just re-downloaded the installer from the Node.js website. This should reinstall all the dependencies and make sure that all paths are valid.
https://nodejs.org/en/download/
This might help for Linux operating system
sudo npm install -g npm#latest
npm install node
npm init
npm install -g yarn
yarn cache clean
npx create-react-app my-app
I also resolved my issue by installing the latest version of node from
https://nodejs.org/en/download/
And then i run below command
npm install -g create-react-app
in the terminal
Followed by "create-react-app " or "create-react-app ." if you are already in the folder.
Try this!
npm install -g npm#latest
npm install node
npm install -g yarn
npx create-react-app appname
cd firstapp
yarn start
Update node modules to version 13.12.0 that works for me
https://nodejs.org/es/download/current/
Yes, I have the same issue and I am unable to solve but after uninstalling yarn and updating node with the latest version.
Also, make sure you have installed
npm i -g create-react-app
after updating the packages.
Clean the cache also to make it free from bugs this will definitely work
Best method for windows user is update your yarn
If you use npx and got error than update yarn then use npx
I have same error in windows 8.1 then I updated yarn and it solved my problem
Npm I yarn#latest
npx creat-react-app app name
I encountered the same problem. It seems that this occurs when npm and node installation is broken. However, sometimes clearing cache doesn't work. I had to not just uninstall but delete/purge all npm and node files on my system, and reinstall them back again.
Remove node and npm
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm
sudo apt remove --purge npm
sudo apt remove --purge node
sudo apt remove --purge nodejs
Check if npm and node are removed by running: which node and which npm
If you still see some folders, try removing them using:
sudo apt-get remove nodejs
sudo apt-get remove npm
Update system, just in case
sudo apt-get update
Install node and npm
sudo apt-get install nodejs
sudo apt-get install npm
Check installation
npm -v
node -v
Note: The steps here involve removing existing modules and putting them back again. I also had to manually uninstall nodejs using Programs and Features (for Windows).
I accidentally hid the .yarnrc file and that caused the problem.
Re-installing node to the latest version worked for me.
https://nodejs.org/en/download/
I had the same problem. Instead of yarn you can use npm to create the app. Just add the --use-npm flag so:
npx create-react-app app --use-npm

Problems installing Vue js

I am trying to install vue.js with no success, yet npm is up to date.
When I run vue init webpack vueapp I get this error:
No command 'vue' found, did you mean:Command 'vpe' from package 'texlive-latex-extra' (universe)
vue: command not found
I have already installed the cli using npm install vue-cli.
Thanks
Try to use npm install -g #vue/cli and then vue ui to start client in your browser.
You'll want to use npm install -g #vue/cli. Restart your terminal to make sure it shows up.
Also, make sure you have node 8.9+
From the docs:
Warning regarding Previous Versions
The package name changed from vue-cli to #vue/cli. If you have the previous vue-cli (1.x or 2.x) package installed globally, you need to uninstall it first with npm uninstall vue-cli -g or yarn global remove vue-cli.
Node Version Requirement
Vue CLI requires Node.js version 8.9 or above (8.11.0+ recommended). You can manage multiple versions of Node on the same machine with nvm or nvm-windows.
For me sudo helps to solve it.
Try to use this command in terminal:
sudo yarn global add #vue/cli
Then you can check the version and all will work correctly.
vue --version
Have you installed view?
Can you check vue --version
https://cli.vuejs.org/guide/installation.html
Try to use sudo npm install -g #vue/cli instead of npm install -g #vue/cli
You need to use sudo.
The vue-cli documentation at https://cli.vuejs.org/guide/installation.html states that:
To install the new package, use one of the following commands. You
need administrator privileges to execute these unless npm was
installed on your system through a Node.js version manager (e.g. n or
nvm).
npm install -g #vue/cli
# OR
yarn global add #vue/cli
Just run npm install -g pnpm for the missing packages.
Then you can run npm install -g #vue/cli
Now you can ckeck the vue --version
sudo npm install -g #aws-amplify/cli --unsafe-perm=true
It works for my situation.

Your global Angular CLI version (6.0.8) is greater than your local version (1.0.2)

C:\dev\myApp> ng serve -o
Your global Angular CLI version (6.0.8) is greater than your local version (1.0.2).
The local Angular CLI version is used.
To disable this warning use `"ng config -g cli.warnings.versionMismatch false"`
I don't know what to do with this.
I tried uninstalling angular/cli and npm cache clean but still have problems.
Anyone help me !
You have the old angular/cli package in your package.json
To update use:
npm r angular-cli
npm i #angular/cli#latest -D
Be aware though, if you have already been using the old cli for a long time, you might have to do some code migration. Especially when it comes to tests, polyfills and the angular config file.
You could try to create an empty angular project using the new cli, and compare the files which are created there, with the files you have in your own project, and update where applicable.
After that, when you have to update your cli again, you can use the new ng update command
You are using new project in older CLI you need to run this commands
npm uninstall --save-dev angular-cli
npm install --save-dev #angular/cli#latest
npm install
or you can try this approach
Updating npm :
Run [sudo] npm install -g npm (sudo is only required on Mac/ Linux)
Updating the CLI :
[sudo] npm uninstall -g angular-cli #angular/cli
npm cache clean
[sudo] npm install -g #angular/cli
i have try all command above but, it don't work. Maybe you can try this command for same probblem. it work for me.
ng update #angular/cli #angular/core
npm uninstall --save-dev angular-cli
npm install
if it still problem you can visit : https://angular.io/cli/update
and you can choice "Angular Update Guide" for specify version update from X to X

Cannot uninstall angular-cli

I've tried several times to uninstall my angular-cli in order to update it but even if I follow the instructions provided on github:
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
When I check using the command ng --version I still get the old version :
angular-cli: 1.0.0-beta.26
node: 7.7.1
os: darwin x64
How can i fix this issue? Thanks
I have also faced the same issue in recent past for me I have do the following commands one by one in terminal.
sudo npm uninstall -g angular-cli
sudo npm cache clean
After this run
ng -v
If still get angular-cli version 1.0.0-beta.2x.x then run the following command
which ng
It will show the ng path. Go to the path and if it is linked with any file remove the same the link and actual ng file. In my case the link is in /usr/bin/ng and actual path of ng file is /lib/node_modules/#angular/cli/bin/ng.
sudo rm -rf /lib/node_modules/#angular/cli/bin/ng
sudo rm -rf /usr/bin/ng
Next you need to install #angular/cli using
sudo npm install -g #angular/cli
Close all the terminal and run ng -v and you are on. May be it will help someone. Thanks :)
If you are facing issue with angular/cli then use the following commands:
npm uninstall -g angular-cli to uninstall the angular/cli.
npm cache clean to clean your npm cache from app data folder under your username.
use npm cache verify to verify your cache whether it is corrupted or not.
use npm cache verify --force to clean your entire cache from your system.
Note:
You can also delete by the following the paths
C:\Users\"Your_syste_User_name"\AppData\Roaming\npm and C:\Users\"Your_syste_User_name"\AppData\Roaming\npm-cache
Then use the following command to install latest angular/cli version globally in your system.
npm install -g #angular/cli#latest
To get more information visit github angular-cli update.
Updating Angular CLI
https://github.com/angular/angular-cli#updating-angular-cli
If you're using Angular CLI 1.0.0-beta.28 or less, you need to uninstall angular-cli package first.
npm uninstall -g angular-cli
npm uninstall -g #angular/cli
npm cache clean
npm install -g #angular/cli#latest
Then when it gets done successfully you may try:
ng --version
This sometime happens when you had actually installed #angular/cli using yarn and not npm.
You can verify this by looking in to yarn's global install folder.
You can remove it from yarn using
yarn global remove #angular/cli
You are using the beta version of angular CLI you can do this way.
npm uninstall -g #angular/cli
npm uninstall -g angular/cli
Then type,
npm cache clean
Then go to the AppData folder which is hidden in your users and go to roaming folder which is inside AppData then go to npm folder and delete angular files in there and also go to npm-cache folder and delete angular components in there.After that restart your PC and type
npm install -g #angular/cli#latest
This worked for me ✌️
I found a solution, first, delete the ng file with
sudo rm /usr/bin/ng
then install nvm (you need to restart your terminal to use nvm).
then install and use node 6 via nvm
nvm install 6
nvm use 6
finally install angular cli
npm install -g #angular/cli
this worked for me, I wanted to update to v1.0 stable from 1.0.28 beta, but couldn't uninstall the beta version (same situation that you desrcibed).
Hope this works
The following approach worked for me:
npm uninstall -g #angular/cli
and
npm cache verify
I had the same problem. This doesn't work:
npm uninstall -g angular/cli
npm cache clean
instead use:
npm uninstall -g # angular/cli
I could not get the angular-cli to go away. I FINALLY figured out a way to find it on my windows machine. If you have Cygwin installed or you are running linux or mac you can run which ng and it will give you the directory the command is running from. In my case it was running from /c/Users/myuser/AppData/Roaming/npm/ng
I had angular-cli version 1.0.0-beta.28.3, and the only thing that worked for me was deleting the angular-cli directly from the global node_modules folder:
cd /usr/local/bin/lib/node_modules
rm -rf angular-cli
After that ng version output was, as expected:
command not found: ng
And I could install the latest angular-cli version:
npm install -g #angular/cli#latest
Hope it helps...
Step 1:
npm uninstall -g angular-cli
Step 2:
npm cache clean
Step 3:
npm cache verify
Step 4:
npm cache verify --force
Note:
You can also delete by the following the paths
C:\Users"System_name"\AppData\Roaming\npm and
C:\Users"System_name"\AppData\Roaming\npm-cache
Then
Step 5:
npm install -g #angular/cli#latest
You have to use (without #)
npm uninstall -g angular/cli
because
If you're using Angular CLI beta.28 or less, you need to uninstall angular-cli package. It should be done due to changing of package's name and scope from angular-cli to #angular/cli https://github.com/angular/angular-cli
Try to update via these steps found in the npm repo for the angular cli.
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli#latest
There is also an angular cli migration guide. One other option (more involved) is to start a new project and migrate over by copying and pasting certain files. This can be found here in the "moving into the cli" section of the angular-cli github
Check if you have the hidden folder ".npm" in your Home directory and delete the old angular-cli folder.
While uninstalling Angular CLI I got the same message (as it had some permission issues):
Unable to delete .Staging folder
I tried deleting the .staging folder manually, but still got the same error. I logged in from my administrator account and tried deleting the staging folder again manually, but to no avail.
I tried this (run as Administrator):
npm uninstall -g #angular/cli
npm cache verify
npm install -g #angular/cli.
Then I tried creating the project from my normal user account and it worked.
For those using Windows, I had this issue because :
after running npm uninstall -g # angular/cli, the folder AppData\Roaming\npm were still containing a ng file
this file prevented a complete uninstall of the CLI
I tried then to remove the ng file manually, but for some reasons it was not possible (I did not have the right), even as admin.
The only hack I found was using a 'linux based' command (I used Git bash) as admin and removing this file from command line:
cd AppData/Roaming/npm
rm ng.cmd
For information: this was with the version 6 of the CLI. There is not problem anymore to remove manually this specific file after the update.

Resources