Pracede
Pracede

Reputation: 4371

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?

Upvotes: 6

Views: 21616

Answers (10)

Gerald Briones
Gerald Briones

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

potatochip
potatochip

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

Vinicius Bazanella
Vinicius Bazanella

Reputation: 505

Using npm the following worked for me:

  1. Open your terminal anywhere and write nano ~/.zshrc
  2. Write the following in the file: export PATH="$PATH:$(npm config get prefix)/bin"
  3. Press Ctrl+X to exit, then Y to save the file and hit Enter to go back to terminal

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

Yuliya Volkova
Yuliya Volkova

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

have you tried yarn? try to install yarn and run yarn global add @vue/cli for me it worked

Upvotes: 0

Jeremias Bila
Jeremias Bila

Reputation: 121

For Mojave, after much struggling, I copied the installed path for @vue/cli

  1. Path [during installation path is shown]

    /Users/{your_username}/
    
    .npm-global/bin
    
  2. Open the GUI with:

    sudo nano ~/.bash_profile
    
    enter your password
    
  3. Paste the copied path as

    export PATH=$PATH:/Users/{your_username}/ .npm-global/bin
    
  4. Run:

    vue --version
    

Upvotes: 1

Anvar Azizov
Anvar Azizov

Reputation: 585

For me worked this steps:

  1. Find the directory path to where vue-cli was installed. Mine was located here [replace username with yours] /Users/username/.npm-packages/bin
  2. Open up your bash profile: sudo nano ~/.bash_profile
  3. Add the following: export PATH=$PATH:/Users/[username]/.npm-packages/bin replacing [username] with your username.
  4. Save the file and restart terminal.
  5. You can now use vue in terminal as expected.

Upvotes: 2

Thomas M
Thomas M

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

Ben Croughs
Ben Croughs

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:

  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

Upvotes: 3

l'L'l
l'L'l

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

Related Questions