1
1

More than 1 year has passed since last update.

Ubuntu で Node の最新版を使う (apt-get 編)

Last updated at Posted at 2020-06-07

Ubuntu に Node の最新版を入れる方法です。 WSL2 の Ubuntu 20.04 で試しました。

PPA の追加、nodejs / npm のインストール

NodeSource Node.js Binary Distributions のインストール手順に従って、PPAを追加します。
apt-get コマンドで nodejs を入れます。 npm コマンドも入るみたいです。

$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ sudo apt install -y nodejs

npmモジュールでnative ビルドが必要なケースに備え、あらかじめビルドツールも入れておくと良いでしょう。

$ sudo apt install -y build-essential

確認

シェルを再起動します。

$ exec $SHELL -l

最新が入りました。

❯ node -v
v14.4.0

❯ npm -v
6.14.5

2020-06-07_16h10_16.png

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