0
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.39.1/install.sh |          bash - && \ 
    . $HOME/.nvm/nvm.sh && \
    nvm ls && \
    chmod -R 777 /bin/ && \ 
    nvm install 18 && \
    nvm install 16 && \
    nvm install 14 && \
    nvm alias default 14 && \
    nvm use default && \
    nvm ls && \
    node -v

I need nvm to build multiple node versions. I am using this on my Jenkins docker agent. But in Jenkins, I got nvm not found.

Ismaili Mohamedi
  • 906
  • 7
  • 15
  • A Docker container only runs one program, and correspondingly an image usually only has one version of its language runtime installed in it. Can you use the `node:14`, `node:16`, or `node:18` images as appropriate, without a version manager? – David Maze Apr 25 '23 at 10:38
  • The `. nvm.sh` line doesn't persist beyond the current `RUN` line, which could be your technical issue. Does [How to install nvm in docker?](https://stackoverflow.com/questions/25899912/how-to-install-nvm-in-docker) address this for you? – David Maze Apr 25 '23 at 10:39
  • Does this answer your question? [How to install nvm in docker?](https://stackoverflow.com/questions/25899912/how-to-install-nvm-in-docker) – Rohit Gupta Apr 26 '23 at 12:13
  • i want to add multiple node versions support in my jenkins agent. nvm is working on agent when i login manually. but when jenkins up a slave agent then in the logs i found that nvm is not found – Hari Shekhawat Apr 26 '23 at 12:42
  • how i can load bashrc file in jenkins build or can change default shell of jenkins agent? – Hari Shekhawat Apr 26 '23 at 12:43

0 Answers0