1
votes

I am trying to learn vuejs.

  1. Run Power shell as an Administrator.

  2. Installed it globally:

    C:\Windows\system32> npm install -g @vue/cli

  3. This message appeared:

npm WARN deprecated [email protected]: cross-spawn no longer requires a build toolchain, use it instead C:\Users\Computer\AppData\Roaming\npm\vue -> C:\Users\Computer\AppData\Roaming\npm\node_modules@vue\cli\bin\vue.js

> [email protected] postinstall C:\Users\Computer\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\protobufjs
> node scripts/postinstall


> [email protected] postinstall C:\Users\Computer\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\nodemon
> node bin/postinstall || exit 0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\@vue\cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ @vue/[email protected]
added 680 packages from 509 contributors in 124.261s
  1. Then I want to check it's version using 'vue --version':

    C:\Windows\system32> vue --version

vue : The term 'vue' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + vue --version + ~~~ + CategoryInfo : ObjectNotFound: (vue:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

I have tried Uninstalled and Reinstall. still not working.

  • my version of node : v10.15.3
  • my version of npm : 6.4.1

What should I do?

4
Make sure you have an Environmental Path set to the correct location. stackoverflow.com/questions/27864040/… First, figure out where node is installing the global modules - browse to C:\Program Files\nodejs\node_modules\npm\bin ..do you see a Vue package in there? Or does it live in: C:\Users\Computer\AppData\Roaming\npm\node_modules ...Is that path part of your Environmental Path Variables? What happens when you do node -v and npm -v ?Matt Oestreich
if i do command like node -v or --version also npm -v or --version it works fine.Evan
interesting... I would check that other thread - something is up with your Environmental Path variables.Matt Oestreich

4 Answers

1
votes

Check out if your prefix is set correctly to your AppData/Roaming/npm/node_modules/ (etc..)

Type npm config get prefix and see if it's there.

If doesn't, that may be causing your -g packages to be installed somewhere else. Do npm config set prefix C:/users/your_user/AppData/Roaming/npm and then try installing some package. That might solve any of unrecognized dependecies to occur.

1
votes

try to reinstalll everything with node 8.11.0 as it's recommanded by @vue/cli

0
votes

In my case the problem was the package name change:

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.

soure: https://cli.vuejs.org/guide/installation.html

0
votes

Try to add following in Path System variable and restart command prompt.

C:\Users\{YourAccount}\AppData\Roaming\npm\node_modules\yarn\bin

once added issue yarn -v and you will see the version output.

Once yarn installed issue below command to install vue-cli

yarn global add @vue/cli @vue/cli-service-global
vue --version will show you the version