0
0

More than 3 years have passed since last update.

【node】MacOSにインストール

Posted at

概要

新端末にnodeをインストールする際に若干ハマったので解決方法を記します。

手順

HomebrewでNodebrewをインストール

brew install nodebrew

早速、エラーが出ます。

Error: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
  softwareupdate --all --install --force

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

指示通りに下記を実行したのち、再度brew install nodebrewを実行。

softwareupdate --all --install --force
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

nodeをインストール

nodebrew install-binary stable

nodeの安定板をインストールしようとすると、またエラーが出ます。

Fetching: https://nodejs.org/dist/v14.15.5/node-v14.15.5-darwin-x64.tar.gz
Warning: Failed to create the file  

ディrクトリを作ってあげれば解決です!

mkdir -p ~/.nodebrew/src

nodeの設定

インストールされているバージョンを調べて、

nodebrew ls
v14.15.5

使いたいものをuseで指定します。

nodebrew use v14.15.5
use v14.15.5

PATHを通してあげれば、

echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.zprofile

使えるようになりました!

node --version       
v14.15.5
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