vscode-dev-containers
vscode-dev-containers copied to clipboard
npm error Cannot find module
Hi,
I'm trying to run this container in my pc and don't works. The container works, but npm doesn't. It gives this error:
In other pc the same project runs correctly. Also i tried the dev container node example and npm works.
dev container:
{
"name": "Node.js",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-20-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/git:1": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
- VSCode Version: Version: 1.80.1 (user setup) Commit: 74f6148eb9ea00507ec113ec51c489d6ffb4b771 Date: 2023-07-12T17:22:07.651Z Electron: 22.3.14 ElectronBuildId: 21893604 Chromium: 108.0.5359.215 Node.js: 16.17.1 V8: 10.8.168.25-electron.0 OS: Windows_NT x64 10.0.22621
Had the same issue this morning (with vscode version 1.83.1 on ubuntu 22.04). This seems to be related to this issue : https://github.com/microsoft/vscode-remote-release/issues/5516
After setting the Debug auto attach to false and rebuild the container i can now use npm/yarn.