Reputation: 4371
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?
Upvotes: 6
Views: 21616
Reputation: 1
Try to install using homebrew and after you installed homebrew check this site to intall vue cli
https://formulae.brew.sh/formula/vue-cli
if you are using vscode and you encountered privilege issue check this youtube video. https://www.youtube.com/watch?v=bjB0g5cagrw
hope this help you
Upvotes: 0
Reputation: 1
add sudo
before those commands, it should work, I have the same issue. You need to give the permission.
Examples:
sudo cnpm install vue-cli -g
sudo cnpm install webpack -g
Upvotes: 0
Reputation: 505
Using npm the following worked for me:
nano ~/.zshrc
export PATH="$PATH:$(npm config get prefix)/bin"
You may now be able to call vue
from terminal. I'm also assuming you've installed the package globally (npm install -g @vue/cli
)
Upvotes: 0
Reputation: 109
If you still have same problem and not only with vue cli, but any packages that must be installed globaly by NPM. For me helped:
brew uninstall node
And load Node.js as .dmg from official web-site https://nodejs.org/en/download/ and install from it.
After did sudo npm install -g @vue/cli and all worked.
Upvotes: 0
Reputation: 4067
have you tried yarn
? try to install yarn
and run yarn global add @vue/cli
for me it worked
Upvotes: 0
Reputation: 121
For Mojave, after much struggling, I copied the installed path for @vue/cli
Path [during installation path is shown]
/Users/{your_username}/
.npm-global/bin
Open the GUI with:
sudo nano ~/.bash_profile
enter your password
Paste the copied path as
export PATH=$PATH:/Users/{your_username}/ .npm-global/bin
Run:
vue --version
Upvotes: 1
Reputation: 585
For me worked this steps:
/Users/username/.npm-packages/bin
sudo nano ~/.bash_profile
export PATH=$PATH:/Users/[username]/.npm-packages/bin
replacing [username] with your username.vue
in terminal as expected.Upvotes: 2
Reputation: 339
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
Upvotes: 6
Reputation: 2663
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:
works like charm
Upvotes: 3
Reputation: 47284
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
.
Upvotes: 3