I am trying to create a centos image with latest node.js LTS version and a npm package. Everything works until the npm command which then fails with the following error:
> [5/5] RUN npm install -g express-generator-typescript:
#8 1.928 /bin/sh: npm: command not found
Here is my Dockerfile:
FROM centos
RUN touch $HOME/.bashrc && \
yum -y install tar gzip gunzip
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash \
&& . $HOME/.bashrc \
&& nvm install --lts
RUN npm install -g express-generator-typescript
Note:
- I want nvm to dynamically install the latest LTS version of node.js.
- If I typed the same commands in a centos container, I can install the NPM package.
How do I solve this problem?