vue-cli: vue upgrade command asks for a plugin and doesn't recognize when it is installed

Version

3.2.1

Environment info

  System:
    OS: Windows 10
    CPU: (8) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
  Binaries:
    Node: Not Found
    Yarn: Not Found
    npm: 6.2.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: 44.17763.1.0
  npmGlobalPackages:
    @vue/cli: Not Found

Note that Node is absolutely installed. "node -v" reports 10.9.0.

Steps to reproduce

  1. run “vue upgrade”
  2. It reports:

Command vue upgrade requires a global addon to be installed. Please run npm install -g @vue/cli-upgrade and try again.

  1. I run the above command, close the terminal, open a new one, and try it again. Same issue.

What is expected?

For it to attempt to update my CLI.

What is actually happening?

It reports what is shown in figure 3.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18

Commits related to this issue

Most upvoted comments

If we execute commands:

npm i @vue/cli @vue/cli-upgrade
vue upgrade

and get the following result:

Command vue upgrade requires a global addon to be installed. Please run yarn global add @vue/cli-upgrade and try again.

Now we open %AppData%\npm\node_modules\@vue\cli\lib\util\loadCommand.js, navigate to line 11 catch (err2), add console.log(err2), run Vue upgrade, get the following results:

Error: Cannot find module ‘@vue/cli-shared-utils

However, we can find the @vue/cli-shared-utils module in the %AppData%\Roaming\npm\node_modules\@vue\cli\node_modules\@vue\ directory.

Now let’s execute commands:

npm uninstall @vue/cli @vue/cli-upgrade -g
yarn global add @vue/cli @vue/cli-upgrade
vue upgrade

and get the following result:

✔ Gathering update information… Already up-to-date.

But one thing that puzzles me is: The expected result could not be obtained yesterday through the following command

npm i yarn -g
yarn global add @vue/cli @vue/cli-upgrade
vue upgrade

I have to use the separate yarn installer to install yarn and then execute other commands. But today there is no problem.

npm i @vue/cli @vue/cli-upgrade -g worked for me (Node 12)