vscode-js-debug: Cannot find module bootloader.js

Lately I’ve been getting this when trying to use the debugger (which now also doesn’t work)

Error: Cannot find module '/Users/[User]/.vscode/extensions/ms-vscode.js-debug-nightly-2020.3.217/src/bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:954:17)
    at Function.Module._load (internal/modules/cjs/loader.js:847:27)
    at Module.require (internal/modules/cjs/loader.js:1016:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1285:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:439:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:66:3)
    at internal/main/run_main_module.js:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

pwa-node doesn’t work at all now 😦 But i can’t reproduce it on a public repo (it may not be related to the above)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 77 (35 by maintainers)

Commits related to this issue

Most upvoted comments

Because this is happening in tasks, I think you’re running into https://github.com/microsoft/vscode/issues/96375. You should be able to fix this by:

  1. Setting debug.node.autoAttach to “disabled” (to clear previous bad state)
  2. Setting it back to on or off, as you prefer
  3. Using the⚠️ icon on the top right to relaunch terminals as desired (or just reopen/reload VS Code)

Okay, thanks. The solution for that issue is here: https://github.com/microsoft/vscode/issues/102057#issuecomment-657728467 If you’re running the latest 1.48, you should only need to do these two steps on workspaces where you have this issue:

  1. Set debug.node.autoAttach to “on”. Wait a moment.
  2. Set debug.node.autoAttach to “disabled”. Wait a moment.
  3. Open a new terminal, or reload the window.

(after this you can safely turn auto attach back on if you’d like to use it)

You can avoid that by setting autoAttachChildProcesses: false

Please set debug.node.autoAttach to disabled for the moment. This will be fixed in the upcoming recovery release.

I discovered another case where this can happen with auto attach on extension version upgrade (https://github.com/microsoft/vscode/issues/96929). I applied a fix for it in the linked commit; you may see this one more time on the next version update, but after today’s nightly (which will be version 2020.5.517) it should no longer be an issue.

Verification steps:

  1. Install any older version of js-debug
  2. Turn on auto attach. Run node and make sure it can attach.
  3. Update to a newer js-debug version, and reload the window
  4. Run node again. It should attach without errors.

If anyone else finds this, this comment has the solution: https://github.com/microsoft/vscode/issues/137794#issuecomment-978093998

Tried that and I am still getting this error. I have checked the file system and the file exists, so can’t it find it?

Any chance you have that left over from the June 2020 release? That problem was prevalent before the recovery release there, and since then we’ll no longer put the bootloader in a tmpdir.

Do these steps fix the issue? https://github.com/microsoft/vscode-js-debug/issues/374#issuecomment-675020979

You can get around that by setting the debug type to pwa-node. The node type goes through our “old” debugger, and its config schema doesn’t know about our new option.

/usr/local/bin/node /Users/user/Documents/flutter/thing/thing2/node index.js

It looks like you have Node trying to run Node… what’s your launch config?

No worries, thanks for the detailed information 🙂

Faced same issue with

❯ code --version
1.74.3
97dec172d3256f8ca4bfb2143f3f76b503ca0534
x64

OS: Linux Mint 20.3 x86_64 
Kernel: 5.4.0-124-generic

Unistalling and reinstalling fixed the problem for me.

I’m encountering a variation of this issue with a project that uses Node 10. I think what’s happening is the plugin initializes against my default Node version (17.x or whatever) and decides spaces in paths are fine. Then I switch to 10.15 (via nvm) and it chokes on “Application Support”:

⟩nvm use
Found '/path/to/project/.nvmrc' with version <10.15.1>
Now using node v10.15.1 (npm v)
internal/modules/cjs/loader.js:583                                                                                       
    throw err;
    ^

Error: Cannot find module '"/Users/ray/Library/Application'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:812:12)
    at preloadModules (internal/bootstrap/node.js:599:7)
    at startup (internal/bootstrap/node.js:273:9)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)

If I remove the NODE_OPTIONS environment variable the error goes away.

⟩echo $NODE_OPTIONS
--require "/Users/ray/Library/Application Support/Code/User/workspaceStorage/746f163c1fc90a7d6784a0a087d9f560/ms-vscode.js-debug/bootloader.js" 

If I disable auto-attach it goes away and I can live with that for now, but if someone has a better idea I’m open to suggestions.

The next version should have the fixes, to be released in about 1.5 weeks. We reintroduce this general strategy, but with many more safeguards and fixes – tracked in https://github.com/microsoft/vscode-js-debug/issues/703

You can probably–I’ve not tested this–fix it globally by deleting (or renaming first, to be safe) your workspace storage folders to clear temp data. I believe by default on OSX this is ~/Library/Application Support/Code/User/workspaceStorage

Awesome, thanks, sent a Teams invite to the email on your GH profile

So, this illustrates my point. I did those steps afresh now, at your advice. I am running 1.48.0, but it didn’t work. Maybe I didn’t “wait a moment” long enough? But I’ve been through this so many times that I’m done with it. It just needs to be fixed, no more workarounds. If you have news of when that fix might arrive, I’m curious to know. In the meantime, I’ll just reach for other tools so I can get work done.

Sorry if this comes off as ungrateful, I do appreciate the hard work that your team is doing. VS Code is an amazing tool, and I’m sure it will continue to be. Thank you!

It’s for both stable and insiders.

Okay, cool. Note that the auto attach variables are set per-workspace, so you may need to do the toggle in multiple folders to clear them out fully

@huixisheng do you get that running things in the terminal? If so, you want to toggle auto attach to “disabled” and then back to on/off

I’m seeing the same issue in 1.47.1.

Version: 1.47.1
Commit: 485c41f9460bdb830c4da12c102daff275415b53
Date: 2020-07-13T22:43:02.577Z
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.5.0

When I launch the debugger in the integrated terminal I get the following error:

env 'NODE_OPTIONS=--require "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js" 

^ this file exists

cat "/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.bundle.js"

But running my action yields this error, it’s like the path isn’t escaped?

internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '"/Applications/Visual'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:901:12)
    at preloadModules (internal/bootstrap/node.js:601:7)
    at startup (internal/bootstrap/node.js:273:9)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Setting Debug > JavaScript: Use Preview to false doesn’t seem to fix it additionally setting Debug: Node: Auto Attach to disabled or toggling it from on/off -> disabled seems to have no affect. Restarting VS Code additionally doesn’t seem to have any affect.

Its’ attempting to run under nvm with node version 10.16.3. It was all working prior to VS Code 1.47

When I upgrade to node 12.16.3 it works

@amlcodes you’re hitting a version of https://github.com/microsoft/vscode/issues/102035#issuecomment-656801666. The resolution steps in the comment will work for you (just ignore the electron part of it)

Issue still occurs for me with latest stable version of node and vscode…

$ yarn
internal/modules/cjs/loader.js:969
  throw err;
  ^

Error: Cannot find module '/var/folders/lp/_d8xd7zs60g73wlpxk2dwh_h0000gn/T/vscode-js-debug-bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1278:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:439:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:71:3)
    at internal/main/run_main_module.js:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}
$ node -v
v12.18.2

sudo yarn works for some reason though ??