34
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

docker npmインストールメモ

Last updated at Posted at 2021-03-02

忘れないようにメモです。

laravel用に作成したdockerのコンテナ内で npm: command not found をいただいたので、
インストールするための手順をまとめる。

環境

使ったimage: php:7.4-fpm-buster
もともとを探るとdebian:buster-slimが使われており、

$ uname -a

を走らせると、 Linux ae39fa4a710d 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 GNU/Linux
と表示される。

コマンド

$ apt update
$ apt install nodejs npm

これだけ!

インストールされたか確認

$ node -v
v10.24.0
$ npm -v
5.8.0

バッチリです!

インストールコマンド

yumだのaptだの色々あって混乱するので一度整理する。

yum

ディストリビューションがRed Hat Enterprise Linux, CentOsであればyum系を使う。
Red Hat形式(.rpm)である。

apt

ディストリビューションがDebian GNU, Ubuntuであればapt系を使う。
Debian形式(.deb)である。

おまけ:homebrew

Macだと homebrewを介して色々インストールすることが多いかも。

参考

https://qiita.com/hal-bo/items/1e0568120c545bf723c6
https://qiita.com/nanbuwks/items/ed8adb2d4324c939a349

34
20
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
34
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?