4

Whenever i run npm list -g --depth=0 command in cmd. I got this error from npm.

+-- @vue/cli@4.5.6
+-- typescript@4.0.3
`-- vue@3.0.0

npm ERR! peer dep missing: vue@3.0.0, required by @vue/compiler-sfc@3.0.0

I have tried different methods to fix this error.

I have also tried uninstalling and installing these packages.

I have also completely uninstalled node and installed it again following this guide. After re-installing the packages, I still get this error.

Anyway to fix this error?

Penny Liu
  • 15,447
  • 5
  • 79
  • 98
Arbaz Irshad
  • 749
  • 2
  • 9
  • 22

4 Answers4

1

Il had the same Problem:

Remove all packages

  • sudo npm uninstall -g @vue and
  • sudo npm uninstall -g typescript also
  • sudo npm uninstall -g vue

Make sure you delete everything: sudo apt remove npm For Apt based Systems, yum remove npm for rpm based

Make sure no binary exists anymore for npm just an example npm version zsh: command not found: npm Then i used snap installation instructions to install the desired package (in this case 12):

Example: sudo snap install node --classic --channel=12

Before you install it againt, follow the instructions here:How to install global packages into own home dir

Then try again sudo npm install -g @vue/cli

Dorian Gaensslen
  • 173
  • 2
  • 10
  • I am on windows. I have tried by completely uninstalling node by following this: https://stackoverflow.com/questions/20711240/how-to-completely-remove-node-js-from-windows. Even after that the error still persists. – Arbaz Irshad Oct 10 '20 at 11:52
1

As-of Jan 2021 the current (default) version of vue is 2.6.12. So by-default @vue/cli will download vue@2.6.12 into it's node_modules (sub-folder), and then complain about it.

To fix it, you can either (a) install vue@3 (as Daniel pointed-out) before installing @vue/cli or (b) cd into the @vue/cli folder, uninstall vue and (re)install vue@3. You can also ignore that message because vue/cli will still run with vue@2.6.12.

tgolisch
  • 6,549
  • 3
  • 24
  • 42
0

You can fix by

npm i -g vue@3

I fixed analogical error messages by command like this.

Other option is

npm remove -g @vue/compiler-sfc
Daniel
  • 7,684
  • 7
  • 52
  • 76
0

To fix this problem, Upgrade your Nodejs to 15.5.1 & npm to 7.4.0. After upgrading, Use npm list -g --depth=0 to check the error. The error will have disappeared.

Arbaz Irshad
  • 749
  • 2
  • 9
  • 22