[英]Node.js error: global module: ' command not found '
解决方案:
.bower-profile
if [ -r ~/.profile ]; then . ~/.profile; fi
case "$-" in *i*) if [ -r ~/.bashrc ]; then . ~/.bashrc; fi;; esac
。轮廓
PATH=~/npm-global/bin:$PATH
原始错误轨迹
Mac OS X El 船长 | 节点 v5.0 | 新产品管理 3.4.0
npm 工作,像 git 这样的全局命令工作。
项目中的bower -g
不起作用。
Aarons-MacBook-Air:test2 Akorn$ ionic start todo blank
-bash: ionic: command not found
Aarons-MacBook-Air:test2 Akorn$ ionic --version
-bash: ionic: command not found
Aarons-MacBook-Air:test2 Akorn$ npm ionic -l -v
3.4.0
权限错误
Aarons-MacBook-Air:test2 Akorn$ brew update && brew upgrade node
Error: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.
You should probably change the ownership and permissions of /usr/local
back to your user account.
sudo chown -R $(whoami):admin /usr/local
Aarons-MacBook-Air:test2 Akorn$ brew --version
Homebrew 0.9.5 (git revision fb84; last commit 2015-12-22)
问题我可以信任 sudo 修复吗?
有没有更好的解决办法?
有没有进一步诊断的方法?
我是怎么破解这个的?
错误地更新 npm 或节点 - 但是 npm 从错误的文件夹调用全局函数。
错误地使用 brew。
.profile
/ .profile_bash
丑陋代码。
~/.bash_profile
:
source ~/.profile
~/.profile
:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
通常,当您看到-bash: mycommand: command not found
这意味着您尝试使用的命令不在 bash 正在查找的位置。 Bash 通常在当前工作目录和$PATH
环境变量中列出的任何位置中查找。
您可以通过运行echo $PATH
来查看$PATH
的当前值。 根据您发布的~/.profile
内容判断,您安装ionic
的位置不是您路径的一部分。 您必须验证该文件的安装位置; 也许/Users/Akorn/npm-global/lib
或者在/usr/local/bin
或/usr/bin
安装了快捷方式,因此您也需要检查它们并确保将它们添加到您的$PATH
。 例如,我的$PATH
看起来像这样; /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Josiah/docker/bin
要了解如何向$PATH
添加新位置,请阅读此问题的第一个答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.