Solution:
.bower-profile
if [ -r ~/.profile ]; then . ~/.profile; fi
case "$-" in *i*) if [ -r ~/.bashrc ]; then . ~/.bashrc; fi;; esac
.profile
PATH=~/npm-global/bin:$PATH
Original Error Trail
Mac OS X El Captain | Node v5.0 | NPM 3.4.0
npm works, global commands like git work.
bower -g
in projects does not work.
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
Permission Error
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)
Questions Can I trust sudo fixes?
Is there a better fix?
Are there methods for further diagnostics?
How did I break this?
Incorrectly updating npm or node - so however npm calls global functions from wrong folder.
Incorrectly using brew.
Ugly code in .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*
Generally when you see -bash: mycommand: command not found
it means that the command you're trying to use isn't located where bash is looking for it. Bash usually looks in the present working directory and in any location that's listed in the $PATH
environment variable.
You can see what the current value of $PATH
is by running echo $PATH
. Judging based on the ~/.profile
contents you posted, the location you have ionic
installed in is not part of your path. You'll have to verify where that file is installed; maybe /Users/Akorn/npm-global/lib
or maybe there was a shortcut installed in /usr/local/bin
or /usr/bin
, so you'll want to check those too and make sure that those are added to your $PATH
. As an example, my $PATH
looks like this; /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/Josiah/docker/bin
To learn how to add a new location to your $PATH
, read up on the first answer to this question .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.