The easiest option:
require.main.require('./config')
This method searches for the module config.js, located in the same directory as the main module.
In more complex cases, you can use the rfr library (this is a separate library, you can download it via npm install rfr ):
var rfr = require('rfr'); rfr('config');
This library searches for modules with respect to the folder that is 2 levels higher than where it was installed.
For simple projects, this will be enough, but if you are writing a library, you need to remember to add rfr to bundledDependencies so that it will be automatically placed in the folder you need when your library is downloaded.
But I would still recommend using relative paths. Why? Because IDE. If you use IDE, then it most likely simply does not understand what kind of module you are loading in a non-standard way.
Relative paths work in any IDE that support modules.