LoginSignup
17
16

More than 3 years have passed since last update.

Raspberry Pi 3 Model B+に最新のNode.jsとnpmをインストールする

Last updated at Posted at 2019-10-05

環境

cat /etc/debian_version
10.4

cat /etc/issue
Raspbian GNU/Linux 10 \n \l

インストール方法

公式にやり方が書いていました。
https://github.com/nodesource/distributions

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

※root権限で実行

バージョン確認

node -v
v12.11.1

npm -v
6.14.5

npmは最新バージョンが入ったが、nodeが最新バージョンになっていない。

nodeを最新バージョンに切り替える

nodeバージョン管理システム「n」をnpmにてインストールし、最新バージョンに切り替える。
tj/n: Node version management

echo "N_PREFIX=$HOME/.n" >> .profile
echo "export PATH=$N_PREFIX/bin:$PATH" >> .profile
source .profile
npm install -g n

最新nodeに切り替え

n latest

バージョンを確認

node -v
v14.5.0

最新バージョンが入りました。
お疲れ様でした。

17
16
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
17
16