Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS : Install vue cli does work properly

I installed vue-cli running the following command:

npm install -g @vue/cli
/Users/me/npm/bin/vue -> /Users/me/npm/lib/node_modules/@vue/cli/bin/vue.js
/Users/me/npm/lib
└── @vue/[email protected] 


When I run vue init, get an the error: "command not found":

vue init webpack vue-app
-bash: vue: command not found

vue-cli does not seem to be in my PATH. When I check the PATH, it includes the directory /Users/me/npm/lib. Here is the result of echo $PATH

/usr/local/git/bin:/Users/me/npm/bin/ng:/Users/me/npm/lib:/usr/bin/local/bin:/Users/me/.rbenv/shims:/Users/me/.rbenv/shims:/usr/local/git/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/Users/me/Tools/apache-maven-3.2.5/bin


What am I missing?

like image 898
Pracede Avatar asked Jun 23 '18 22:06

Pracede


People also ask

How do I know if vue command line is installed?

You can verify that it is properly installed by simply running vue , which should present you with a help message listing all available commands.

Should I install vue CLI globally?

In my personal opinion, you should just install @vue/cli in your home or $HOME , and export the binaries from node modules bin folder to access it globally without providing a sudo password. Avoid the -g flag while installing.


3 Answers

The same issue occurred for me when running:

npm install -g @vue/cli

After much research and experimentation the only thing that worked instead was:

npm install -g @vue/cli@latest

like image 172
Thomas M Avatar answered Sep 20 '22 00:09

Thomas M


You could try adding this to your $PATH:

/Users/me/npm/bin

Your $PATH currently goes one level deeper than this, in which case wouldn’t see the content of bin.

like image 42
l'L'l Avatar answered Sep 19 '22 00:09

l'L'l


i had a sort a like issue on my mac, my problem was that i already had an old version installed, here are the stips i did to make it work:

  1. goto folder: /usr/local/lib/node_modules/ (in finder, choose go and then folder)
  2. move folders @vue and vue-cli to trash
  3. sudo npm install @vue/cli -g
  4. enter you admin password

works like charm

like image 39
Ben Croughs Avatar answered Sep 19 '22 00:09

Ben Croughs