0
0

More than 3 years have passed since last update.

nodebrewのパス設定に関する備忘録

Posted at

nodebrewをインストールしようとした際にパス設定でつまづいたのでその時の備忘録です。

1.やったこと

前提環境:
MacOS Catalina 10.15.7
homebrew導入済み

1.nodebrewをインストール

brew install nodebrew

2.環境変数を追加
bash_profileファイルに以下の通り環境変数を追加してパスを通した

export PATH=$HOME/.nodebrew/current/bin:$PATH

3.bash_profileを読み直して設定反映

source ~/.bash_profile

4.nodebrewで使用するディレクトリセットアップ

nodebrew setup

5.最新版nodeのインストール

nodebrew install latest

2.問題

nodebrew, nodeはインストールできているのにnodeコマンドが使えない。。。

3.原因

MacOS Catalinaからは、デフォルトのシェルスクリプトがbashからzshになったため、bash_profileではなくzshの設定ファイルに環境変数を追加する必要があった

※以下コマンドで現在使用しているシェルスクリプトの種類を確認することができる

echo $SHELL

4.解決法

1.bash_profileではなくzshrcファイルに設定を追加

export PATH=$HOME/.nodebrew/current/bin:$PATH

2.zshを読み直して設定反映

source ~/.zshrc

まとめ

シェルスクリプトの種類などあまり意識せず使用していましたが、注意しないといけないなと思いました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0