Open Domajno opened 7 years ago
This is because Trails figures out its current root directory from require.main
, which is the module from which it is required. Because you're running from the node repl, there is no main module. I'm sorry you're having this issue -- we hadn't considered this use case in designing the configuration.
Try setting require.main
manually before instantiating Trails, e.g.
require.main = process.env.PWD + '/server.js'
Issue Description
When I open node and type following commands (same as inside server.js) I get following error:
When I run
node server.js
everything is fine. It is becauserequire.main
is not defined when node is running without a script being specified. Is is an expected behaviour? It is causing us headaches when we try to use Jest for testing.Environment