How can I update vue cli version? - vue.js

I want to create a project on Vue Project Manager. When I try, I see that error message;
"vue create is a Vue CLI 3 only command and you are using Vue CLI 2.9.6."
This is my vue --version output: #vue/cli 4.0.5.
How can I fix this?
My system configuration is as follow:
Ubuntu 18.04
Npm 6.13.0
Node 10.16.3

Uninstall it first with
npm uninstall vue-cli -g or yarn global remove vue-cli
Then install it again with
npm install -g #vue/cli
# OR
yarn global add #vue/cli
The package name changed from vue-cli to #vue/cli that is why you need to uninstall it first and install it again.

First remove the existing package from globally Make sure you have administrator priviledge
npm uninstall vue-cli -g
Then -
I believe this will work and install latest version
npm install -g #vue/cli
Reference - https://cli.vuejs.org/guide/installation.html
Once you done Verify
vue --version

It worked on my work approach, uninstall the vue and reinstall using the steps in the documentation. enter link description here
1 - remove vue: sudo npm uninstall -g vue-cli
2 - install using: sudo npm install -g #vue/clisudo npm uninstall -g vue-cli

I found that in my case, I have had #vue/cli installed using npm install -g and also yarn add global.
for that reason even when I did yarn global remove #vue/cli, I still would get result from vue --version resulted in: -old-version-number-.
I had to to also uninstall it with:
npm uninstall vue-cli -g

It seems you have more than one versions of vue.
Delete the #vue folder from this directory
C:\Users\Muhammad Abbas\AppData\Roaming\npm\node_modules
After that run this command
npm install -g #vue/cli
This will solve the Problem

You could install 'vue' somewhere by yarn, which put this 'vue' in your path ahead of /usr/local/bin. so do this first:
which vue
if this output is not the one you just reinstalled, just remove it. After this, run which vue again to check, and vue -V to confirm it has been upgrade to what you've installed.

This would work with version 3 of Vue CLI
npm update -g #vue/cli

The recommended way to start a Vite-powered Vue project.
Visit GitHub
https://github.com/vuejs/create-vue
I made it myself with this method:
1=> npm uninstall -g vue-cli
2=> npm i -g #vue/cli
3=> vue create myproject
4=> cd myproject
5=> npm run serve

Related

I can't uninstall vue from ubuntu

Hello i'm working on WSL and to run my vue project i need vue 2.9.0
and vue -V shows vue 2.9.6
I'v tried comand npm uninstall #vue/cli and npm uninstall -g #vue/cli
but vue -V still shows vue 2.9.6
Please help
Did you try to clear the cache?
The following should work:
npm uninstall -g #vue/cli
npm clear cache --force
If you are using the older version of vue cli (1.x or 2.x) like you are, then you can uninstall it like this.
npm uninstall -g vue-cli

Error while installing expo-cli with npm and yarn

I don't know whats's wrong with my system I am trying to setup expo-cli with yarn global add expo-cli the expo init projectname doesn't work and its getting me same problem when I am trying to install with sudo npm install expo-cli --global?
This is the problem with yarn https://i.stack.imgur.com/q518S.png
&
This is the problem with npm https://i.stack.imgur.com/ojF0h.png
yarn install worked but directory where yarn puts executables for packages is not added to your PATH. If you add it there it should work.
If you want to go with npm, I would strongly recommend to never run npm install with sudo. Use tools like nvm or volta. It will install node, npm and all other packages in your home directory, it should solve all issues with permissions without giving access to your entire system.
https://github.com/nvm-sh/nvm
Try avoiding the global npm install with npx expo-cli
Alternatively, try sudo npm install -g --unsafe-perm expo-cli to install the package globally through root. This seems to be a common error with Ubuntu, more information can be found here: https://github.com/expo/expo-cli/issues/591

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

How to fix the error when installing vue-cli

when I run the command npm install -g vue-cli I get the following warning, apparently I have no errors
but when executing
vue init webpack my-project
or
vue --version
this pops up
As the docs say vue-cli is the old package name
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.
cf: https://cli.vuejs.org/guide/installation.html
As manu said try using npm install -g #vue/cli
use command : sudo npm install -g #vue/cli
as the error is because of permission
The error seems to be cause by permission, you could run powershell with admin then run the command npm i -g #vue/cli

How to uninstall Gulp CLI from NPM globally?

I have the following package installed globally via npm:
+-- gulp-cli#2.0.1 (github:gulpjs/gulp-cli#4782b9a582ce7cc7e009073705a565b57d235332)
I have tried to uninstall it like so...
npm uninstall gulp-cli#2.0.1
But it does not remove it. How can I get this package removed from my global location?
I'm on npm version 6.1.0
Thanks to R. Wanjohi I figured it out for my machine. I had to do the following to get the global version of gulp cli off my machine:
npm rm -g gulp-cli
I was experiencing the same problem but when I used the following code, it worked:
npm rm -g gulp
You need to uninstall it globally (add the -g tag)
npm uninstall -g gulp-cli#2.0.1
Here is the npm docs: https://docs.npmjs.com/cli/uninstall.html
it's pretty simple, to uninstall a global package run
npm uninstall -g <package-name>
to verify run
npm ls -g --depth=0
for short videos