When working with NodeJS inside a DevContainer using VSCode, sometimes an error comes up whenever you try to run a node application or npm command (i.e. npm install). The error looks something like this:
Error: Cannot find module ‘/some/path/with/ahashvalue/vscode-js-debug-bootloader.js’
It happened to me on stream a while back and I’ve been meaning to share the fix for a while now.
Because this is happening in tasks, I think you’re running into microsoft/vscode#96375.
You should be able to fix this by
- Setting debug.node.autoAttach to “disabled” (to clear previous bad state)
- Setting it back to on or off, as you prefer
- Using thewarning icon on the top right to relaunch terminals as desired (or just reopen/reload VS Code)
Follow the steps in the VSCode settings for the DevContainer (i.e. workspace) and it works. Here’s an example of me doing it on stream.
Note: The fix happens right away, but it takes a minute for me to test and confirm it.
Here’s hoping this helps someone else out there looking for this solution.
Thanks for playing.