Reputation: 14417
So i have this directory structure
--- root
|--- server
|--- config
|--- pfio
|--- pfio-server.js
|--- event-bus.js
|--- server.js
In my pfio-server.js
file i require the event-bus.js
file so I use this:
var eventBus = require('./server/config/pfio/event-bus');
This is pretty standard, goes without saying really. However, when I run the server.js
it says it can't find the module event-bus
Say what....
Upvotes: 0
Views: 82
Reputation:
In Node, imports are relatives from the current file (if you do a relative import) so if you're in pfio-server.js
you can simply require('./event-bus');
Upvotes: 2