Skip to content

Node 11.4.0+ fails to resolve index.js when combined with -r and --inspect-brk #25967

Closed
@jdalton

Description

@jdalton

index.js

console.log("hi from index.js")

preload.js

console.log("hi from preload.js")

In Node 11.3.0 and below this works:

node -r ./preload.js --inspect-brk index.js

and results in:

Debugger listening on ws://127.0.0.1:9229/3a4d89ae-03a7-45f0-b740-711ac3fb490e
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
hi from preload.js

However, in Node 11.4.0+ it errors with:

Debugger listening on ws://127.0.0.1:9229/d9fa3f56-312d-4288-a61c-9eb221c0ad02
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'index.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Module._compile (internal/modules/cjs/loader.js:702:31)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:659:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:844:12)
    at prepareUserCodeExecution (internal/bootstrap/node.js:297:7)
    at startExecution (internal/bootstrap/node.js:275:5)
Waiting for the debugger to disconnect...

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions