microsoft / vscode-js-debug

A DAP-compatible JavaScript debugger. Used in VS Code, VS, + more
MIT License
1.67k stars 281 forks source link

Cannot find module bootloader.js #374

Closed jasonwilliams closed 4 years ago

jasonwilliams commented 4 years ago

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)

idoyana commented 4 years ago

got the same issue here, i'm using restart in launch configuration and the issue happen only after the restart (when code changed) image

here is the launch.json image

i've tried to change the autoAttach to all different options - but the issue persist

connor4312 commented 4 years ago

You can avoid that by setting autoAttachChildProcesses: false

idoyana commented 4 years ago

You can avoid that by setting autoAttachChildProcesses: false

it is working! thanks a lot!

@connor4312 btw, i'm getting the following hint image

connor4312 commented 4 years ago

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.

connor4312 commented 4 years ago

It's for both stable and insiders.

tehpsalmist commented 4 years ago

Is there a fix for this on the horizon? I'm just curious because I don't have time any more to run through all the permutations of solutions in this thread (often none of which work) just so I can run a terminal command that I can use iTerm for and just bypass the problem. Nevertheless, I do prefer to use the built-in terminal when I can. ¯_(ツ)_/¯

connor4312 commented 4 years ago

@tehpsalmist what issue are you hitting? There's quite a few different discussions in this thread 🙂

tehpsalmist commented 4 years ago

just every 3rd workspace I open has some kind of bootloader.js is missing error. It's been a couple months of this now, so I'm kind of hoping a fix is close. Sorry if this isn't my most productive comment. Here's my most recent error:

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

Error: Cannot find module '/var/folders/cm/mkjr9w6557d0hwpy6vytw5mh0000gn/T/vscode-js-debug-bootloader.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:824: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)

I've also noticed that this only happens with certain commands (I believe only node cli tools, as git works fine in these messed up terminals).

connor4312 commented 4 years ago

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)

tehpsalmist commented 4 years ago

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!

connor4312 commented 4 years ago

The instructions linked are the fix; I haven't before received reports of them not working. Would you be willing to share a screen recording (gifcap is good),, or hop on a screenshare so I can see exactly what you're doing / what's happening?

tehpsalmist commented 4 years ago

Sure, I can spare like 5 minutes

connor4312 commented 4 years ago

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

tehpsalmist commented 4 years ago

Unfortunately, I'm still having trouble with this. For some reason, most of my workspaces have a non-working terminal and a handful of them work. I've tried the workarounds, and I've tried to replicate that process we (@connor4312 ) did over the screenshare where we installed a later version of the debugger and then turned the autoattach on/off. Either I just can't remember the correct debug package to do that with or the problem is not that uniformly distributed across my machine. Either way, I would really love to get this working again. Any advice is welcome, but ideally a future version of vs code will just have the proper migrations or fixes to make this a non-issue.

connor4312 commented 4 years ago

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

tehpsalmist commented 4 years ago

Ah, thank you, deleting that directory does seem to have brought a few workspaces back to working condition. If I find more that can't be fixed by the strategies listed above I'll report on it, but for now this seems to have straightened things out for me.

jeffbski-rga commented 4 years ago

I am having this error too with the August 2020 release.

LSTL67fchtdd:~/projects/cloud-loadresults [sonar-2020-09-21]$ npm run test:unit
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module '/var/folders/m3/y7pcwbqj6nq9lrhmff598j74hgrysl/T/vscode-js-debug-bootloader.js'

If I run this in a iterm terminal outside of vscode then everything is fine, so this is something related to vscode.

I do not have the ~/Library/Application Support/Code/User/workspaceStorage folder

connor4312 commented 4 years ago

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

jeffbski-rga commented 4 years ago

Yes, thanks @connor4312 that fixes it.

rayhatfield commented 3 years ago

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.

connor4312 commented 3 years ago

Yea, we don't have any way to detect nvm version changes. All Node version that don't support quotes (<12) are in end of life so I do not plan to go through great lengths to discover a workaround for this.

rayhatfield commented 3 years ago

Understood. Posted mostly just to get confirmation that that is what's happening and I'm not missing some obvious fix, and to provide info for future VS Code archaeologists. Thanks.

Porges commented 2 years ago

I am getting this constantly, on multiple different codespaces/repos. Is there any current known issue?

Porges commented 2 years ago

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

JustinGrote commented 2 years ago

@Porges this fixes it temporarily but it happens on every codespaces rebuild. Is there a more permanent fix? I tried putting various autoattach settings into my devcontainer file with no luck.

RaviPabari commented 1 year ago

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.

louwers commented 1 year ago

Still running into this and none of the posted solutions seem to work.

I am not even trying to use the debugger, just using npm in the terminal.

Edit: reinstalling the plugin worked.

shemy-gan commented 4 months ago

Linux: Ubuntu 20.04 Node 18.13 Vscode: 1.89.1

do a npm --version, getting below Error: Cannot find module '/snap/code/155/usr/share/code/resources/app/extensions/ms-vscode.js-debug/src/bootloader.js' Require stack:

Austint30 commented 3 months ago

Hello,

Seems like this is still an issue in 2024. Getting this output after running npm install <name>:

node:internal/modules/cjs/loader:1189
  throw err;
  ^

Error: Cannot find module '/home/node/.vscode-server/data/User/workspaceStorage/9271fbbe3b75a285e8c4679515f8dd2a/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload
    at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
    at Module._load (node:internal/modules/cjs/loader:1012:27)
    at Module.require (node:internal/modules/cjs/loader:1271:19)
    at Module._preloadModules (node:internal/modules/cjs/loader:1653:12)
    at loadPreloadModules (node:internal/process/pre_execution:687:5)
    at setupUserModules (node:internal/process/pre_execution:200:5)
    at prepareExecution (node:internal/process/pre_execution:153:5)
    at prepareMainThreadExecution (node:internal/process/pre_execution:52:10)
    at node:internal/main/run_main_module:13:19 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

Node.js v22.2.0

Disabling and re-enabling auto attach fixes the issue temporarily, but I have to do this every time I start up the dev container.

lamuertepeluda commented 3 months ago

I am still having this issue for VSCode 1.91.1 on macOS Sonoma (Apple Silicon).

Trying to debug some (rather complex) jest tests

Error: Jest: Got error running globalSetup - /usr/src/app/test/setup.ts, reason: Command failed: node -r ts-node/register ./src/cli.ts merge-openapi
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/ms-vscode.js-debug/src/bootloader.js'
Require stack:
- internal/preload
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at internalRequire (node:internal/modules/cjs/loader:176:19)
    at Module._preloadModules (node:internal/modules/cjs/loader:1563:5)
    at loadPreloadModules (node:internal/process/pre_execution:730:5)
    at setupUserModules (node:internal/process/pre_execution:206:5)
    at prepareExecution (node:internal/process/pre_execution:159:5)
    at prepareMainThreadExecution (node:internal/process/pre_execution:54:10)
    at node:internal/main/run_main_module:11:19 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

Node.js v20.15.1

    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:519:28)
    at ChildProcess.emit (node:domain:488:12)
    at maybeClose (node:internal/child_process:1105:16)
    at Socket.<anonymous> (node:internal/child_process:457:11)
    at Socket.emit (node:events:519:28)
    at Socket.emit (node:domain:488:12)
    at Pipe.<anonymous> (node:net:338:12)

The toggle does not seem to work for me :(