LoginSignup
3
0

More than 1 year has passed since last update.

Node.js 16 on Ubuntu 20.04 セットアップ

Last updated at Posted at 2022-04-02

Ubuntu 20.04 LTS の標準では Node.js バージョン 10 がインストールされるため、
公式のレポジトリから個別に最新安定版の 16 をインストールする方法

参考ページ

Node.js 公式サイト
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Binary for Debian/Ubuntu (公式からリンクあり)
https://github.com/nodesource/distributions/blob/master/README.md

インストールバージョン

Ubuntu 20.04 LTS
Node.js 16.14.2 LTS

動作確認は、Docker上のUbuntuで行なっています

Ubuntu インストール

(省略)

Node.js インストール

レポジトリ追加コマンド(Using Debian, as root)を発行

/bin/bash
curl -fsSL https://deb.nodesource.com/setup_16.x | bash -

パッケージをインストール

/bin/bash
apt update && apt install -y nodejs

動作確認

任意の場所にエディタで hello.js を作成

hello.js
console.log("hello world!");

nodeで実行
hello world!と表示されればインストール成功

/bin/bash
node hello.js

備考

インストールで使用したコマンドを DockerfileRUN コマンドで指定すれば、
Dockerイメージに含めてビルドすることが可能

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