🐙

Macでnpmコマンドが使えなくなったときに試したことnpm command not found

2020/01/20に公開

ターミナルを起動すると下記のエラーが

bash: /Users/gdtypk/.bash_profile: line 20: syntax error: unexpected end of file

.bash_profile見てみる

大体、コピペで作っていたので、おかしい箇所が分からなかったが、 最後の方のif文が、fiで終わっていなかったことが原因みたい。

# Setting PATH for Python 3.7

The original version is saved in .bash_profile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH="HOME/.pyenv/shims:PATH"
export DYLD_FALLBACK_LIBRARY_PATH=HOME/anaconda/lib/:DYLD_FALLBACK_LIBRARY_PATH

Setting PATH for pyenv

eval "$(pyenv init -)"
PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
if [ -f ~/.bashrc ] ; then
. ~/.bashrc

正しい書き方

これ書いてないと、.bashrcが反映されませんでした。

if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi

GitHubで編集を提案

Discussion