I often find that I want to globally install a specific version of npm in my devcontainers when using the node feature. Otherwise, if I haven't used the container in a while, npm commands will add extra noise telling me to update, but then the update is removed if I rebuild the container again. I can get around this with an onCreateCommand in my devcontainer.json that runs npm install -g npm@<version>, but it would be nice to have this baked into the image if possible.
So ideally, I'd like to configure my npm version right alongside my node version in the devcontainer like this:
I often find that I want to globally install a specific version of npm in my devcontainers when using the node feature. Otherwise, if I haven't used the container in a while, npm commands will add extra noise telling me to update, but then the update is removed if I rebuild the container again. I can get around this with an
onCreateCommandin mydevcontainer.jsonthat runsnpm install -g npm@<version>, but it would be nice to have this baked into the image if possible.So ideally, I'd like to configure my npm version right alongside my node version in the devcontainer like this: