天天看点

mac运行vue,Mac OS:安装vue cli可以正常工作

mac运行vue,Mac OS:安装vue cli可以正常工作

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?

解决方案

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.