Migsar Navarro
Migsar Navarro

Reputation: 355

What is the proper way to attach to a remote container in Visual Studio Code to be able to run yarn commands inside it?

When I create a dev container outside of Visual Studio Code and then I attach to a running container, often, but not all the times, I got the following error:

root@4fed72573fdd:/app# yarn dev
internal/modules/cjs/loader.js:818
  throw err;
  ^

Error: Cannot find module '/root/.vscode-server/data/User/workspaceStorage/c8b7499a7d3347c27a0d7093feba1e49/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1147:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:446:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:74:3)
    at internal/main/run_main_module.js:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}
root@4fed72573fdd:/app#  

If I connect to the container via docker I am able to run yarn dev, it is just inside Visual Studio Code remote containers terminal that it does not work.

Upvotes: 1

Views: 1272

Answers (1)

LilumDaru
LilumDaru

Reputation: 105

I had a similar problem. It seems to be an Error with the Auto-attach feature of the Javascript debugger.

  1. in vscode press [Strg] + [Shift] + [P]
  2. Type "toggle Auto Attach" and select it.
  3. select "Disable"
  4. Repeate Steps 1 + 2 and select whatever you like

execute your node.js command

Upvotes: 1

Related Questions