Node not working in existing workspace

I’ve been using a workspace to work on a Next.js project. So far so good. I left for a couple of hours so the workspace was stopped. When I got back, workspace is restarted but node is broken.

Trying to run node or npm in the terminal results in the following error:

$ node
  throw err;

Error: Cannot find module '/home/gitpod/.gitpod-code/User/workspaceStorage/3b19fc43-1/ms-vscode.js-debug/bootloader.js'
Require stack:
- internal/preload
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at Module._preloadModules (internal/modules/cjs/loader.js:1231:12)
    at loadPreloadModules (internal/bootstrap/pre_execution.js:468:5)
    at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:71:3)
    at internal/main/repl.js:19:1 {
  requireStack: [ 'internal/preload' ]

Here’s the .gitpod.yml for reference.

  - init: npm install
  - name: Dev Server
    command: npm run dev

  - port: 3000
    visibility: private
    onOpen: open-preview

    # enable for the default branch (defaults to true)
    master: true
    # enable for all branches in this repo (defaults to false)
    branches: true
    # enable for pull requests coming from this repo (defaults to true)
    pullRequests: true
    # enable for pull requests coming from forks (defaults to false)
    pullRequestsFromForks: true
    # add a check to pull requests (defaults to true)
    addCheck: true
    # add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
    addComment: true
    # add a "Review in Gitpod" button to the pull request's description (defaults to false)
    addBadge: true

    - dbaeumer.vscode-eslint
    - mikestead.dotenv
    - jock.svg

It just happened again. I had to destroy the workspace yesterday to fix it. And today, same thing.

How can node/npm break all of a sudden?

Ok, it is related to the Auto-attach feature of the Javascript debugger. Turning it off fixes the issue.