Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to update vue-cli? #212

Closed
xrr2016 opened this issue Oct 26, 2016 · 30 comments
Closed

How to update vue-cli? #212

xrr2016 opened this issue Oct 26, 2016 · 30 comments

Comments

@xrr2016
Copy link

xrr2016 commented Oct 26, 2016

No description provided.

@egoist
Copy link
Collaborator

egoist commented Oct 26, 2016

Reinstall npm i -g vue-cli will do the favor.

@egoist egoist closed this as completed Oct 26, 2016
@CharlesOkwuagwu
Copy link

@egoist how do you update a project built with a lower version of the cli?

@egoist
Copy link
Collaborator

egoist commented Jan 30, 2017

@CharlesOkwuagwu you mean templates or vue build?

@CharlesOkwuagwu
Copy link

I mean a project already set up with an older version of vue, how do we get the project updated via the cli

@LinusBorg
Copy link
Member

LinusBorg commented Jan 30, 2017

You don't, currently. The templates+CLI don't support any kind of update process, so you will have to bump dependencies manually.

Depending on what you changed in the template you are currently using, it might be easier to generate a new project, copy over /src & /static, and re-apply any changes you made to the webpack config & package.json scripts, if any.

@posva
Copy link
Member

posva commented Jan 30, 2017

I'd add to what @LinusBorg said that git is your friend 😄

@LinusBorg
Copy link
Member

...and maybe that we are thinking about how to improve upgrades in the future, but that's nothing that will happen very soon.

@hackuun
Copy link

hackuun commented Jan 28, 2018

Is it happening a year ago?

@LinusBorg
Copy link
Member

Yes, actually. You can find an Alpha Version of vue-cli 3 in the next branch.

@bitbytebit1
Copy link

bitbytebit1 commented Feb 11, 2018

@LinusBorg, so can we update our projects now? Or do we still have to do it the manual way?

@LinusBorg
Copy link
Member

Nothing changed for old projects, but new projects created with vue-cli 3 can be updated by simply updating the dependencies.

@muntac
Copy link

muntac commented Jun 25, 2018

Note that if you're already on 3.0 and are trying to upgrade, npm i -g vue-cli will install 2.* (2.9.6 in my case). Instead, try npm i -g @vue-cli.

@Akryum
Copy link
Member

Akryum commented Jun 28, 2018

This means you have the old vue-cli package installed. You need to uninstall it.

@mak2014
Copy link

mak2014 commented Jul 10, 2018

This worked for me:

Uninstall first:

npm uninstall -g vue-cli

Install:

npm install -g @vue/cli

@ZadaWu
Copy link

ZadaWu commented Aug 7, 2018

seems we need to install the latest, I worked when I add @latest:

npm install -g @vue/cli@latest

@LinusBorg
Copy link
Member

It works without latest as well.

@typerory
Copy link

typerory commented Aug 19, 2018

I ran npm i -g vue-cli and I went back to 2.9.6
I then ran npm i -g @vue-cli and got errors
I then ran npm install -g @vue/cli@latest and got 3.0.1
Strange but it worked.

@longrunningprocess
Copy link

@typerory I think you meant to run npm i -g @vue/cli on your second attempt (/ not -)

@xing00
Copy link

xing00 commented Nov 8, 2018

vue-cli has changed to vue/cli,can see this at https://cli.vuejs.org/guide/installation.html
uninstall vue-cli first with npm uninstall vue-cli -g or yarn global remove vue-cli, then run npm install -g @vue/cli or yarn global add @vue/cli, you will get it.
1

@grusingh
Copy link

grusingh commented Dec 21, 2018

Reinstall npm i -g @vue/cli will do the favor.

Reinstall npm i -g vue-cli will do the favor.

@PolymathWhiz
Copy link

sudo npm install -g @vue/cli@latest did the trick

@uke5tar
Copy link

uke5tar commented Apr 15, 2019

i first uninstalled old vue globally
npm uninstall -g vue-cli
and then installed the new version
npm install @vue/cli -g
This was the only way it worked for me.

@MickaelBergem
Copy link
Contributor

FYI on my end vue upgrade works fine:

$ vue upgrade --help
Usage: upgrade [options] [semverLevel]

upgrade vue cli service / plugins (default semverLevel: minor)

Options:
  -h, --help  output usage information

I'm not sure when this got introduced, but it should probably be in https://cli.vuejs.org/?

@ppKrauss
Copy link

Hello, why must use sudo? The solution above is good, but only runs with sudo.

@mmichealjroberts
Copy link

Is anyone else seeing an issue when updating the @vue/cli (with sudo) they're still getting a write permission error to the Missing write access to /usr/local/lib/node_modules/@vue/cli/node_modules/ folder?

@gustawdaniel
Copy link

gustawdaniel commented Dec 3, 2019

First check which version are you using

which vue

In my case:

/home/daniel/.config/yarn/global/node_modules/.bin/vue

Then remove this version

cd /home/daniel/.config/yarn/global/
cat package.json

In my case

{
  "dependencies": {
    "@vue/cli-init": "^3.0.5",
    "@vue/cli-service-global": "^3.8.4",
    "bower-away": "^1.1.2",
    "node-gyp": "^3.7.0"
  }
}

Then

yarn global remove @vue/cli-init
yarn global remove @vue/cli-service-global

Now

which vue

Indicates

/home/daniel/.nvm/versions/node/v12.6.0/bin/vue

So

npm remove --global vue-cli

Then following after official docs

https://cli.vuejs.org/

npm install -g @vue/cli

If any cache disturb in this process type bash.

Now

vue --version
@vue/cli 4.1.1

Before

vue --version
2.9.6

Please do not use sudo installing packages by npm. You can read more about it in articles like this

https://medium.com/@ExplosionPills/dont-use-sudo-with-npm-still-66e609f5f92

To manage npm dependencies i recommend use nvm it is described here

https://linuxize.com/post/how-to-install-node-js-on-ubuntu-18.04/

@greatgraphicdesign
Copy link

I'm fairly new to using npm, and I'd like to understand this better.

I read the above statement from @LinusBorg that says...

new projects created with vue-cli 3 can be updated by simply updating the dependencies.

Today vue --version returns @vue/cli 4.3.1.

I have projects that I created previously using vue create <project> when my @vue/cli version was older. I'm thinking I would like to update those projects, but I don't see @vue/cli listed in package.json as a dependency...

  "dependencies": {
    "core-js": "^3.6.4",
    "vue": "^2.6.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.3.0",
    "@vue/cli-plugin-eslint": "~4.3.0",
    "@vue/cli-service": "~4.3.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },

Can someone explain more explicitly (for a newbie) what should I take to update those older projects, or if I don't need to, please explain why so I can understand?

@lianmakesthings
Copy link

lianmakesthings commented Aug 3, 2020

@greatgraphicdesign @vue/cli now has experimental tools to upgrade your older projects

# In the root folder of your project
❯ vue --version
@vue/cli 4.4.6

# Check which packages are outdated
❯ vue outdated
✔  Gathering package information...
  Name                        Installed       Wanted          Latest          Command to upgrade
  @vue/cli-service            4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-service
  @vue/cli-plugin-babel       4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-babel
  @vue/cli-plugin-unit-mocha  4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-unit-mocha
  @vue/cli-plugin-vuex        4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-vuex

# Upgrade all outdated packages
❯ vue upgrade
✔  Gathering package information...
  Name                        Installed       Wanted          Latest          Command to upgrade
  @vue/cli-service            4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-service
  @vue/cli-plugin-babel       4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-babel
  @vue/cli-plugin-unit-mocha  4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-unit-mocha
  @vue/cli-plugin-vuex        4.2.3           4.2.3           4.4.6           vue upgrade @vue/cli-plugin-vuex
? Continue to upgrade these plugins? Yes
Upgrading @vue/cli-service from 4.2.3 to 4.4.6
+ @vue/cli-service@4.4.6
added 28 packages from 56 contributors, removed 2 packages, updated 35 packages and audited 1436 packages in 52.823s

Upgrading @vue/cli-plugin-babel from 4.2.3 to 4.4.6
+ @vue/cli-plugin-babel@4.4.6
added 29 packages from 7 contributors, removed 2 packages, updated 84 packages and audited 1463 packages in 14.409s
🚀  Running migrator of @vue/cli-plugin-babel
✔  Successfully invoked migrator for plugin: @vue/cli-plugin-babel

Upgrading @vue/cli-plugin-unit-mocha from 4.2.3 to 4.4.6
+ @vue/cli-plugin-unit-mocha@4.4.6
added 4 packages from 3 contributors, removed 4 packages, updated 17 packages, moved 1 package and audited 1463 packages in 17.732s

Upgrading @vue/cli-plugin-vuex from 4.2.3 to 4.4.6
+ @vue/cli-plugin-vuex@4.4.6
updated 1 package and audited 1463 packages in 9.642s

 DONE  All plugins are up to date!

This will also automatically update your package-lock.json and package.json.

Hope this helps

@greatgraphicdesign
Copy link

Thank you very much! That does help.

@shirinzadeh
Copy link

I install the @vue/cli npm i -g @vue/cli , but before installing I didn't uninstall the vue-cli.
WIll this become a problem or give errors in the future? Should I uninstall the vue-cli after installing @vue/cli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests