Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with mcr.microsoft.com/devcontainers/typescript-node running npm #1189

Open
nickshanks347 opened this issue Sep 16, 2024 · 3 comments
Open

Comments

@nickshanks347
Copy link

I tried the mcr.microsoft.com/devcontainers/typescript-node containers :20 & :22. When trying to run npm with the default node user, I get this error:

$ npm --version
node:internal/modules/cjs/loader:1251
  throw err;
  ^

Error: Cannot find module '/root/.vscode-server/data/User/workspaceStorage/ecbd587727c66e87727639745fae6f85/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at Module._preloadModules (node:internal/modules/cjs/loader:1826:12)
    at loadPreloadModules (node:internal/process/pre_execution:730:5)
    at setupUserModules (node:internal/process/pre_execution:205:5)
    at prepareExecution (node:internal/process/pre_execution:158:5)
    at prepareMainThreadExecution (node:internal/process/pre_execution:53:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

Node.js v22.8.0

I am using a devcontainer.json with just "image": "mcr.microsoft.com/devcontainers/typescript-node:22" defined.

@nickshanks347
Copy link
Author

The same thing actually happens with the root user too, I have to run sudo -i and then yarn/npm starts working. Why is this?

devcontainer.json:

// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
	"name": "Node.js & TypeScript",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/base:ubuntu",

	// Features to add to the dev container. More info: https://containers.dev/features.
	"features": {
		"ghcr.io/devcontainers/features/node:1": {
			"version": "lts",
			"installYarnUsingApt": true
		}
	},

	// 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": "yarn config set --home enableTelemetry 0 && yarn install",

	// Configure tool-specific properties.
	"customizations": {
		"vscode": {
			"extensions": [
				"esbenp.prettier-vscode",
				"dbaeumer.vscode-eslint",
				"arcanis.vscode-zipfs",
				"dsznajder.es7-react-js-snippets"
			]
		}
	},

	// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
	"remoteUser": "root"
}

@samruddhikhandale
Copy link
Member

@prathameshzarkar9 @gauravsaini04 Can you help debug this? thanks!

@gauravsaini04
Copy link
Contributor

gauravsaini04 commented Oct 10, 2024

Hi @samruddhikhandale, @nickshanks347
I had tried building dev containers for the above 3 scenarios:

  • mcr.microsoft.com/devcontainers/typescript-node:20
  • mcr.microsoft.com/devcontainers/typescript-node:22
  • above given devcontainer.json

But I was not able to see the similar error msg as yours. It only printed the version of npm that I had.
@nickshanks347, if possible, could you please provide us with a minimal reproduction example? This will allow us to replicate the problem on our end and investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants