问题描述
npm install vue-cli -g成功安装之后,执行vue -V提示 command not found
xxx:node_modules xxx$ sudo cnpm install vue-cli -g
Downloading vue-cli to /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli_tmp
Copying /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli_tmp/_vue-cli@2.9.6@vue-cli to /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli
Installing vue-cli's dependencies to /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli/node_modules
[1/20] commander@^2.9.0 installed at node_modules/_commander@2.16.0@commander
[2/20] minimatch@^3.0.0 installed at node_modules/_minimatch@3.0.4@minimatch
[3/20] ora@^1.3.0 installed at node_modules/_ora@1.4.0@ora
[4/20] multimatch@^2.1.0 installed at node_modules/_multimatch@2.1.0@multimatch
[5/20] rimraf@^2.5.0 existed at node_modules/_rimraf@2.6.2@rimraf
[6/20] chalk@^2.1.0 installed at node_modules/_chalk@2.4.1@chalk
[7/20] semver@^5.1.0 installed at node_modules/_semver@5.5.0@semver
[8/20] tildify@^1.2.0 installed at node_modules/_tildify@1.2.0@tildify
[9/20] uid@0.0.2 installed at node_modules/_uid@0.0.2@uid
[10/20] read-metadata@^1.0.0 installed at node_modules/_read-metadata@1.0.0@read-metadata
[11/20] coffee-script@1.12.7 existed at node_modules/_coffee-script@1.12.7@coffee-script
[12/20] metalsmith@^2.1.0 installed at node_modules/_metalsmith@2.3.0@metalsmith
[13/20] user-home@^2.0.0 installed at node_modules/_user-home@2.0.0@user-home
[14/20] consolidate@^0.14.0 installed at node_modules/_consolidate@0.14.5@consolidate
[15/20] validate-npm-package-name@^3.0.0 installed at node_modules/_validate-npm-package-name@3.0.0@validate-npm-package-name
[16/20] async@^2.4.0 installed at node_modules/_async@2.6.1@async
[17/20] download-git-repo@^1.0.1 installed at node_modules/_download-git-repo@1.0.2@download-git-repo
[18/20] request@^2.67.0 installed at node_modules/_request@2.87.0@request
[19/20] handlebars@^4.0.5 installed at node_modules/_handlebars@4.0.11@handlebars
[20/20] inquirer@^6.0.0 installed at node_modules/_inquirer@6.0.0@inquirer
deprecate metalsmith@2.3.0 › gray-matter@2.1.1 › coffee-script@^1.12.4 CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
All packages installed (251 packages installed from npm registry, used 4s, speed 1.86MB/s, json 235(1.53MB), tarball 5.21MB)
[vue-cli@2.9.6] link /usr/local/Cellar/node/10.6.0/bin/vue@ -> /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli/bin/vue
[vue-cli@2.9.6] link /usr/local/Cellar/node/10.6.0/bin/vue-init@ -> /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli/bin/vue-init
[vue-cli@2.9.6] link /usr/local/Cellar/node/10.6.0/bin/vue-list@ -> /usr/local/Cellar/node/10.6.0/lib/node_modules/vue-cli/bin/vue-list
xxx:node_modules xxx$ vue -V
-bash: vue: command not found
解决方案
添加环境变量配置
xxx:9.10.0 xxx $ export PATH="$PATH:/usr/local/Cellar/node/10.6.0/bin"
xxx:9.10.0 xxx$ vue
Usage: vue <command> [options]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
init generate a new project from a template
list list available official templates
build prototype a new project
create (for v3 warning only)
help [cmd] display help for [cmd]
xxx:9.10.0 xxx$ vue -V
2.9.6
网友评论