0
0

[Node.js] [nodebrew] [Mac] nodebrewを使用してMacにNode.jsをインストールする

Last updated at Posted at 2024-07-28

目次

Homebrewでnodebrewをインストール

  1. brewでnodebrewを検索する

    brew search nodebrew
    

    image.png

  2. インストールする

    brew install nodebrew
    
  3. セットアップを行う

    nodebrew setup
    

    PATH情報が出力される。
    image.png

  4. PATH情報を.zshrc (bashを使用している場合は、.bash_profile)に追記する。

    echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zshrc
    
  5. sourceコマンドを使用して変更を反映させる。

    source .zshrc
    

nodebrewでNode.jsをインストール

  1. インストール可能なnode.js(npm)のバージョンを確認する

    nodebrew ls-remote
    
  2. インストールする

    // バージョンを指定したインストール
    nodebrew install v16.16.0
    
    // 最新版をインストール
    nodebrew install latest
    
    // 安定版をインストール
    nodebrew install stable
    
  3. 正常にインストールされているか確認

    nodebrew list
    

    image.png

  4. Node.jsはインストールされただけで有効化されていないため、以下コマンドにて有効化

    nodebrew use v22.5.1
    
  5. Node.js(npm)の動作を確認

    node -v
    npm -v
    

参考リンク

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