Liam Martens

Often times it is useful to use a system-wide .npmrc file to authenticate to private repositories. However when working with development containers in VS Code you lose this context as the container is, of course, fully isolated.

However you can actually mount your global .npmrc file inside your container with some clever configuration inside your devcontainer.json file.

"image": "node:14",
"containerUser": "node",
"mounts": [

Using the mounts configuration, it is possible to attach the system-wide .npmrc file to your container as a docker volume. This way your development container will be able to use your previously authenticated npm repositories. Awesome!