Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix "zsh: command not found: vue"?

I installed @vue/cli on my mac, but whenever I type “vue”, my terminal says “zsh: command not found: vue” - How can I fix this problem? I searched similar issues and already spent half a day, but still not solved...

This is my environment:

  • macOS Catalina version 10.15
  • npm 6.4.1
  • node v10.13.0

I changed $PATH by doing this:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc

Now this is:

echo $PATH
/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/usr/local/share/dotnet:/opt/X11/bin:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands

It looks like @vue/cli is installed, but I don't know why vue command is not found. Don't I have an admin privilege?

~ % npm install -g @vue/cli
/Users/ami/.npm_global/bin/vue -> /Users/ami/.npm_global/lib/node_modules/@vue/cli/bin/vue.js
+ @vue/[email protected]
updated 1 package in 46.758s
~ % node -v
v10.13.0
~ % npm -v
6.4.1
~ % vue -v    
zsh: command not found: vue
~ % vue create new-project
zsh: command not found: vue

I'm following Vue CLI's instruction, so the result is supposed to be creating a new vue project. https://cli.vuejs.org


SOLVED Thank you for your advice! I tried ~ % export PATH=~/.npm_global/bin:$PATH and my path became:

~ % echo $PATH
/Users/ami/.npm_global/bin
:/usr/local/bin
:~/.npm_global/bin
:/usr/local/bin
:~/.npm_global/bin
:/usr/local/bin
:/usr/bin
:/bin
:/usr/sbin
:/sbin
:/Library/Apple/usr/bin
:/Library/Apple/bin
:/usr/local/share/dotnet
:/opt/X11/bin:~/.dotnet/tools
:/Library/Frameworks/Mono.framework/Versions/Current/Commands

And try again:

~ % vue --version
@vue/cli 4.0.5

Worked!

like image 403
Ami Avatar asked Oct 28 '19 12:10

Ami


People also ask

How do you fix Vue is not recognized as an internal or external command operable program or batch file?

To solve the error "'vue' is not recognized as an internal or external command, operable program or batch file", install the @vue/cli package globally by running npm install -g @vue/cli , restart your terminal and make sure your PATH environment variable is set up correctly.

How do I find my VUE version?

Check the version number you have installed by using the command: vue --version .


1 Answers

if none of the above work

npm config set prefix /usr/local

and

npm install -g @vue/cli 

that's worked for me

like image 101
Nafiz Bayrak Avatar answered Sep 19 '22 09:09

Nafiz Bayrak