Vue-CLI NPM Install Vue Command not Found

I’ve been trying to install the vue CLI but keep getting told that the Vue command is not found.

I’ve updated GIT, I’ve updated Node and I’ve updated my Mac OS.
I’ve tried un-installing and re-installing the vue cli but still the same Vue command is not found.

Any tips on where this may have gone wrong?

$ sudo npm install --global vue-cli
Password:
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to “coffeescript” (no hyphen)
/Users/craigharvey/.npm-global/bin/vue -> /Users/removed/.npm-global/lib/node_modules/vue-cli/bin/vue
/Users/craigharvey/.npm-global/bin/vue-init -> /Users/removed/.npm-global/lib/node_modules/vue-cli/bin/vue-init
/Users/craigharvey/.npm-global/bin/vue-list -> /Users/removed/.npm-global/lib/node_modules/vue-cli/bin/vue-list
+ vue-cli@2.9.3
updated 1 package in 7.182s
Vue JS UDEMY removed$ vue init webpack my-project
-bash: vue: command not foundVue JS UDEMY removed$

Similar issue… did you resolve this.

Yes, I recently managed to fix this.

I had an issue my Node reverting to an older version every time I restarted my machine.

This turned out to be an issue with NVM - Node version manager.

I re-installed this using this guide and discovered the Vue-CLI had not installed in the correct folder in NVM, Vue-CLI had somehow been installed against a specific version of node and not in the global folder which was causing it to revert. I’ve no idea how I managed that.

Once I reset the NVM the version of Node no longer reverted back to an older version when I restarted my computer and once I had reinstalled the Vue-CLI everything works fine.

TLDR - Possibly something in your Node Version, not exactly sure how but I fixed mine that way.

Good luck!

I suggest running npx @vue/cli create $application
This does the trick without permanently installing vue-cli. And on top: you always get the current version.

1 Like

It works, but what is npx?

Short:

This does the trick without permanently installing vue-cli.

Detail:

it works,

but how to install template

When I installed the vue-cli tools, I found myself with one major issue: I kept getting the error vue:command not found in my terminal window when I would try and run vue --version or vue create my-project.

I followed the instructions on the website https://cli.vuejs.org on installation of the cli tools:

npm install -g @vue/cli or yarn global add @vue/cli

It installed with no problem but the command was still not found. I even uninstalled and reinstalled with sudo but no luck either.

Here’s what I did to fix this error

When you install it, find the directory path to where it was installed. Mine was located here[replace username with your username] /Users/username/.npm-packages/bin .

Open up your bash profile: sudo nano ~/.bash_profile

Add the following: export PATH=$PATH:/Users/[username]/.npm-packages/bin replacing [username] with your username.

Save ctrl=+o and exit trl+x the file and restart terminal.
and create your first vue project

You can now use vue in terminal as expected.