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)

connor4312 commented 4 years ago

What does ls ~/.vscode/extensions/ms-vscode.js-debug-nightly-2020.3.217/src say? The bootloader file is present for me there, wonder if you got a corrupted install somehow.

jasonwilliams commented 4 years ago

It does show when I do that (which makes it more odd), so I’m not sure. I’ll see if it keeps happening, it can be inconsistent

connor4312 commented 4 years ago

What might have happened is that the extension activated and was then updated without reloading / in another vscode window. Then the old extension folder was deleted, which caused the bootloader script disappeared. I can't seem to get into that state playing around locally, but that's one idea...

jasonwilliams commented 4 years ago

Yeah there’s a chance of that, is there a way for me to debug if that’s the case? I’ll look out for it again

connor4312 commented 4 years ago

If you see it happen again, take note of the version in the path it's looking for, then open the extension panel in vscode and see what version of the extension it says is installed.

phyllisstein commented 4 years ago

I’m seeing something quite similar in my project. I’ve got a tasks.json file with the following configuration:

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "npm",
      "script": "start:dev",
      "problemMatcher": {
        "owner": "node",
        "fileLocation": "absolute",
        "pattern": {
          "regexp": "^🚨  (.*?):((\\d):(\\d):)? (.*)$",
          "line": 3,
          "column": 4,
          "file": 1,
          "message": 5
        },
        "background": {
          "activeOnStart": true,
          "beginsPattern": "^Server running at",
          "endsPattern": "^✨  Built in"
        }
      },
      "presentation": {
        "echo": true,
        "reveal": "always",
        "focus": false,
        "panel": "shared",
        "showReuseMessage": true,
        "clear": false
      },
      "label": "npm: start:dev",
      "detail": "Start the Parcel development server",
      "isBackground": true
    },
  ]
}

When I run the task, I see the following messages in VSCode’s terminal pane:

> Executing task: npm run start:dev <

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

Error: Cannot find module '/var/folders/82/x75jd1fx0jj40t9s7tnghvxc0000gp/T/vscode-js-debug-bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1292: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' ]
}
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

The same thing happens when I run an automatically detected and configured task:

> Executing task: npm run build <

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

Error: Cannot find module '/var/folders/82/x75jd1fx0jj40t9s7tnghvxc0000gp/T/vscode-js-debug-bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:976:15)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1036:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1292: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' ]
}
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

When I run the task with the Developer Tools open, I see the following logged to the browser console:

log.ts:197   ERR ioctl(2) failed, EBADF: Error: ioctl(2) failed, EBADF
    at UnixTerminal.resize (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/node_modules.asar/node-pty/lib/unixTerminal.js:238:13)
    at e.resize (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:3342:64)
    at e.setDimensions (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4344:261)
    at e._resize (file:///Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:4442:108)

I don’t really have a great sense of what all that could mean, I’m afraid. I can confirm that there is no vscode-js-debug-bootloader.js file in that temporary folder, but I’m not sure how to troubleshoot beyond that.

My VSCode version info is:

Version: 1.45.0-insider
Commit: 2a36b7d0d527bf408bae4f96b8386db9d9455113
Date: 2020-05-01T01:50:35.321Z (1 hr ago)
Electron: 7.2.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

I currently have v2020.4.3017 of this package installed.

connor4312 commented 4 years ago

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)
phyllisstein commented 4 years ago

That did it! Thank you so much. I guess the two issues weren’t as similar as they looked. 🙊

connor4312 commented 4 years ago

No worries, thanks for the detailed information 🙂

jasonwilliams commented 4 years ago

Because this is happening in tasks, I think you're running into microsoft/vscode#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)

This would make a great FAQs answer

connor4312 commented 4 years ago

The root cause got fixed in the commit that closed that bug, so it should not be an ongoing issue--this is the first report community report I've received of it so far 🙂

connor4312 commented 4 years ago

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.
paulsimongb commented 4 years ago

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?

connor4312 commented 4 years ago

See your issue here: https://github.com/microsoft/vscode/issues/101996

rossmc commented 4 years ago

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 ??

ochicf commented 4 years ago

I have a similar issue that started after updating VSCode to the latest version. I did not change the launch.json and it was working before (hence, it is correct).

The issue happens when opening a terminal in VSCode. The following error is thrown:

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

Error: Cannot find module '/var/folders/4g/885bdns57cqf1cqzx8dw0vch0000gn/T/vscode-js-debug-bootloader.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:945:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:363:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:61:3)
    at internal/main/run_main_module.js:11:1

And I cannot use the terminal anymore as I guess the configuration is broken:

➜ node -v                           
zsh: command not found: node
➜ nvm current   
none

Information about my setup (from About VSCode):

Version: 1.47.0
Commit: d5e9aa0227e057a60c82568bf31c04730dc15dcd
Date: 2020-07-09T08:01:54.115Z
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

Some more info:

connor4312 commented 4 years ago

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

mikeshot commented 4 years ago

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

Thank you! Having the same issue & this fixes it (at least for now).

amlcodes commented 4 years ago

No luck at all, when launching debugger.

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

Error: Cannot find module '"/home/node/.vscode-server-insiders/bin/e7920dce7bfd0b707ebfc0a5379c6edd2233e475/extensions/ms-vscode.js-debug/src/bootloader.bundle.js"

launch.json - seems like "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node" is doing it

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Launch",
      "type": "node",
      "request": "launch",
      "protocol": "inspector",
      "program": "${workspaceRoot}/src/index.js",
      "stopOnEntry": false,
      "args": [],
      "cwd": "${workspaceRoot}",
      "preLaunchTask": null,
      "runtimeExecutable": "${workspaceRoot}/node_modules/.bin/babel-node",
      "runtimeArgs": [
        "--nolazy"
      ],
      "env": {
        "NODE_ENV": "development"
      },
      "console": "internalConsole",
      "sourceMaps": false,
      "outFiles": []
    }
  ]
}
connor4312 commented 4 years ago

@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)

aventurella-honey commented 4 years ago

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

connor4312 commented 4 years ago

@aventurella-honey your issue is also https://github.com/microsoft/vscode/issues/102035#issuecomment-656801666 (just ignore the electron part)

kristof-mattei commented 4 years ago

@connor4312 what do you mean by

Using the⚠️ icon on the top right to relaunch terminals as desired (or just reopen/reload VS Code)

I don't see that icon?

connor4312 commented 4 years ago

If you're on OSX or Linux (particularly if your machine crashed) you may be stuck and can follow the second set of instructions here: https://github.com/microsoft/vscode/issues/102057#issuecomment-657728467

superbizon2003 commented 4 years ago

Same problem with cyrillic username: Error: Cannot find module 'c:/Users/�������_�/.vscode/extensions/ms-vscode.js-debug-nightly-2020.7.1617/src/bootloader.bundle.js'

connor4312 commented 4 years ago

@superbizon2003 see here https://github.com/microsoft/vscode-js-debug/issues/563#issuecomment-659592018

superbizon2003 commented 4 years ago

@superbizon2003 see here #563 (comment)

It worked! Thanks

huixisheng commented 4 years ago
Version: 1.47.2
Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf
Date: 2020-07-15T18:18:50.054Z (2 days ago)
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.0.0

with errors:

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

Error: Cannot find module '/var/folders/h9/53v387jx0mq2rrywyyjfzs1h0000gn/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)
connor4312 commented 4 years ago

@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

huixisheng commented 4 years ago

@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

yep, it works when I restart vscode. thank you.

rochdev commented 4 years ago

I tried every possible combination of enabling/disabling auto attach and restarting VS Code and I still can't get rid of the issue. Anything else can be done other than switching to a nightly build?

paulsimongb commented 4 years ago

For me, it was upgrading Node to the latest version that cured it

rochdev commented 4 years ago

I get the same issue even after upgrading (just tried 12.16.1 which has been working for a while, 12.18.2 and 14.5.0). The issue started about 30 minutes ago, right after updating VS Code.

connor4312 commented 4 years ago

Please share the error message you're receiving and your VS Code version.

rochdev commented 4 years ago
internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module '/var/folders/zh/6ycfn26d0hg_1njrc6lgbmyr0000gn/T/vscode-js-debug-bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Module.require (internal/modules/cjs/loader.js:1044:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1298:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:444:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:68:3)
    at internal/main/run_main_module.js:7:1 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'internal/preload' ]
}

Version: 1.47.2 Commit: 17299e413d5590b14ab0340ea477cdd86ff13daf Date: 2020-07-15T18:18:50.054Z 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.6.0

connor4312 commented 4 years ago

Please try these steps: https://github.com/microsoft/vscode/issues/102057#issuecomment-657728467

rochdev commented 4 years ago

Did everything except installing VS Code Insider and I still get the same error.

connor4312 commented 4 years ago

To be clear, when do you get that error? Is that whenever you run a Node command on the terminal, or only when debugging?

rochdev commented 4 years ago

Tried node -v, which worked, then tried again yarn and the error is gone. No idea why that is but at least it works now 😄

connor4312 commented 4 years ago

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

armchairdeity commented 4 years ago

FYI - I had to do the trick with disabling debug.node.autoAttach just today with the current version (1.47.2).

And the issue I was having today really threw me for a loop, because it was when I was trying to build my Docker image... it turns out it was an error where npm install was actually the one throwing the error. And it was anything... nodemon, node, npm, even nvm didn't like whatever had happened.

All I know for sure is that the debug.node.autoAttach fix worked and I was glad. lol

cmawhorter commented 4 years ago

i just updated to 1.47.3 and was still seeing this issue. (missing is vscode-js-debug-bootloader.js)

the only thing that worked was setting debug.node.autoAttach to "disabled".

and to people that were as dumb as me: "off" is not the same as "disabled". you must do this to actually disable auto attach:

after that the error went away.

FickleLife commented 4 years ago

I am getting this error for the last hour (was working fine before that?)

I tried "debug.node.autoAttach": "disabled" (mine was already disabled) Hitting F5 yields:

/usr/local/bin/node /Users/user/Documents/flutter/thing/thing2/node index.js
Debugger listening on ws://127.0.0.1:50591/8b6e06d7-2c93-4f88-ac76-b996595e3cde
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
internal/modules/cjs/loader.js:1068
  throw err;
  ^

Error: Cannot find module '/Users/user/Documents/flutter/thing/thing2/node index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Process exited with code 1

File is definitely located at the path mentioned....

connor4312 commented 4 years ago

/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?

FickleLife commented 4 years ago

Thanks @connor4312, I just used the default launch.json and it seemed to add a node at the start....

mirzaumersaleem commented 4 years ago

Because this is happening in tasks, I think you're running into microsoft/vscode#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)

Resolved! , Thanks champ

SebastiaoMoraes commented 4 years ago

Se você vir isso acontecer novamente, anote a versão no caminho que está procurando, abra o painel de extensão no vscode e veja a versão da extensão que está instalada.

It didn't work for me either. I still have debug unavailable

SebastiaoMoraes commented 4 years ago

Recebo. Error Vscode

connor4312 commented 4 years ago

You're hitting https://github.com/microsoft/vscode-js-debug/issues/563

SebastiaoMoraes commented 4 years ago

Você está atingindo # 563

Debugger remains unavailable