Docker Community Forums

Share and learn in the Docker community.

Docker noob node app won't run in container - "Cannot find module bootloader.js"

I’m new to docker and have been trying to get it working for my current node app within VS Code but I can’t get it to run at all.

I’m running Windows 10 and the app is a basic node-typescript back end with a few express endpoints configured, and a connection to mongodb using mongoose.

What I did inside VS Code:

A) Installed the Docker and Remote - Containers extensions

B) Ran the “Remote containers: Add development container configuration files” command

C) Selected “Node.js & TypeScript”, followed by 14

D) Populated the config files as follows (mostly as default):

Dockerfile (left as default)

ARG VARIANT=“14-buster”
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}

devcontainer.json

{
“name”: “Node.js & TypeScript”,
“build”: {
“dockerfile”: “Dockerfile”,
“args”: {
“VARIANT”: “14”
}
},
“settings”: {
“terminal.integrated.shell.linux”: “/bin/bash”
},
“extensions”: [
“dbaeumer.vscode-eslint”
],
“forwardPorts”: ,
“postCreateCommand”: “npm install”,
}

E) Ran “Remote containers: rebuild and reopen in container”

VS code then loads up the project inside a container as expected. The command “uname” returns “Linux” and “node --version” returns “v14.16.1”. However the command “nodemon” returns “command not found” and if I try to simply run the commands “node”, “npm”, “npm --version” I receive the following error, which is preventing me from running the app:

internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module ‘/home/node/.vscode-server/data/User/workspaceStorage/ae82091cea133ac67d0fc7620ee9d4af/ms-vscode.js-debug/bootloader.js’
Require stack:
internal/preload
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at Module._preloadModules (internal/modules/cjs/loader.js:1217:12)
at loadPreloadModules (internal/bootstrap/pre_execution.js:449:5)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:76:3)
at internal/main/run_main_module.js:7:1 {
code: ‘MODULE_NOT_FOUND’,
requireStack: [ ‘internal/preload’ ]
}

Exploring the directory in the container using the integrated terminal it doesn’t look like I have a .vscode folder inside /home/node. “ls -a” inside /home/node returns “. … .bash_logout .bashrc .config .npm .oh-my-bash .oh-my-zsh .profile .zshrc”.

Any ideas what is wrong?