LoginSignup
1
0

More than 1 year has passed since last update.

n を使って Node.jsのバージョンをダウングレードする(macOS)

Last updated at Posted at 2021-06-08

Node.js のアンインストール

Node.js 14.17.0 を導入したものの、 Node.js 10.x にダウングレードする必要が生じました。
ダウングレードの実施方法はいろいろありますが、今回は n を利用してダウングレードを実施したため、その作業ログを残します。
n コマンドの詳細はこちら。
https://www.npmjs.com/package/n

環境

macOS Big Sur 11.4

ダウングレード手順

root ユーザーに切り替えます。suコマンドを実行し、パスワードを入力します。

$ su 

n をインストールします。

sh-3.2# npm install -g n
/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n
+ n@7.3.0
added 1 package from 2 contributors in 0.343s

n がインストールされました。
現在導入されている node のバージョンを確認しておきます。

sh-3.2# node -v
v14.17.0

ダウングレード先のバージョンを引数に設定し、 n を実行します。
念の為、リリース一覧よりダウングレードするバージョン番号を確認します。
10.12.0にダウングレードすることにします。
https://nodejs.org/ja/download/releases/

sh-3.2# n 10.12.0
  installing : node-v10.12.0
       mkdir : /usr/local/n/versions/node/10.12.0
       fetch : https://nodejs.org/dist/v10.12.0/node-v10.12.0-darwin-x64.tar.xz
   installed : v10.12.0 (with npm 6.4.1)

ダウグレード後のバージョンを確認します。10.12.0 にダウングレードできました。

sh-3.2# node -v
v10.12.0

以上です。

1
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
1
0