Categories
JavaScript Answers

How to install Node.js nvm in Docker?

Spread the love

To install Node.js nvm in Docker, we run curl to install it.

For instance, in our dockerfile, we add

SHELL ["/bin/bash", "--login", "-c"]

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN nvm install 10.15.3

to run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash

to download the nvm install script and run bash to install it with the downloaded script.

And then we run

nvm install 10.15.3

to install nvm 10.15.3.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *