Persisting node version

Hello, the project I am working on requires a node version of 16+ and an npm version of 7+. By default node version is 14.17.5 and npm: 6.14.14 on my setup. After updating the node to the latest version using nvm install 16.9.1, it works on the current terminal. But it doesn’t persist when I stop the workspace and open it again. It doesn’t even persist on a new terminal. I have tried nvm alias default 16.9.1 but it didn’t work for me.

Hi
are you using a custom Dockerfile like this?

FROM gitpod/workspace-full:latest

RUN bash -c ". .nvm/nvm.sh && nvm install 14 && nvm use 14 && nvm alias default 14"

RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix

// install npm and other stuff

and in gitpod.yaml

image:
  file: .gitpod.Dockerfile

works for me - gitpod starts and loads my custom dockerfile - hope this is helpfull

2 Likes