Skip to content

require(): no information about where error #3784

Closed
@amurchick

Description

@amurchick

When errors in require()'d file:

$ node -v
v5.0.0
$ node
> require('./auth')
SyntaxError: Unexpected identifier
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at repl:1:5
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)

I am understand - error in auth.js, but no info where error occurred was provided - files sometimes big and no quick way to localize error.

Early - some useful diagnostics was provided:

$ node -v
v0.12.7
$ node
> require('./current')
/path/to/file/current:1
unction (exports, require, module, __filename, __dirname) { 2015-11-11_23:04:3
                                                                    ^^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at repl:1:1
    at REPLServer.defaultEval (repl.js:132:27)
    at bound (domain.js:254:14)
> 

Metadata

Metadata

Assignees

No one assigned

    Labels

    moduleIssues and PRs related to the module subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions