Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全局安装的 npm 包无法使用 #25

Closed
Dream4ever opened this issue May 29, 2018 · 0 comments
Closed

全局安装的 npm 包无法使用 #25

Dream4ever opened this issue May 29, 2018 · 0 comments
Labels
Software About installation ande usage

Comments

@Dream4ever
Copy link
Owner

需求描述

在 Mac 下全局安装了 vue-cli,但是没法使用,提示 zsh: command not found: vue

方案调研

调研过程

执行 yarn global list,看到有 vue-cli 这个包。但是执行 vue init webpack project 时,却提示 zsh: command not found: vue

用关键字 vue-cli command not found vue Google,第一个链接 bash: vue: command not found 提到了可以用 npm root -g 查看 npm 的全局路径,在 Mac 下的输出结果是 /Users/samsara/.nvm/versions/node/v9.11.1/lib/node_modules

进入该目录,发现没有 vue-cli 文件夹,但是有 nodemon 和 pm2 这两个全局安装的包,猜测 yarn 的包信息不准确。

再根据第一个链接中提到的 echo $PATH 查看环境变量,有 /Users/samsara/.nvm/versions/node/v9.11.1/bin 这么个路径,进到这个文件夹下,发现依然是有 nodemon 和 pm2,没有 vue-cli,基本验证了自己的猜测。

于是用 yarn 先删除然后再安装 vue-cli,发现调用时依然报错。于是回头再看刚才的 Google 结果,第二个链接 vue: command not found in Mac OS · Issue #732 · vuejs/vue-cli · GitHub 中说用 npm 全局安装 vue-cli:npm i vue-cli -g,照着做了之后,这次果然可以正常调用了,真是奇怪的问题。

入选方案

要点总结

和之前 IIS 代理的静态页面 #15 无法稳定访问的问题一样,尝试替代方案,说不定就解决了呢。

@Dream4ever Dream4ever added the Software About installation ande usage label May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Software About installation ande usage
Projects
None yet
Development

No branches or pull requests

1 participant