0
0

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 1 year has passed since last update.

コンテナにNode.jsの指定バージョンをインストールする

Posted at

nvmを用いてインストールを行います。
nvmを使用すれば、簡単に複数のバージョンをインストールすることができます。

ARG NVM_VERSION=17.1.0

ENV NVM_DIR /root/.nvm

RUN apt-get install -y \
        curl

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash \
    && . ${NVM_DIR}/nvm.sh \
    && nvm install ${NVM_VERSION} \
    && nvm alias default ${NVM_VERSION} \
    && nvm use default \
    && ln -s ${NVM_DIR}/versions/node/${NVM_VERSION}/bin/node /usr/bin/node \
    && ln -s ${NVM_DIR}/versions/node/${NVM_VERSION}/bin/npm /usr/bin/npm \
    && ln -s ${NVM_DIR}/versions/node/${NVM_VERSION}/bin/npx /usr/bin/npx

NVM_VERSION はdocker-compose.ymlに記載することも可能です

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?