Latest node documentation says:
Loading from the global folders
If the NODE_PATH environment variable is set to a colon-delimited list of absolute paths, then node will search those paths for modules if they are not found elsewhere. (Note: On Windows, NODE_PATH is delimited by semicolons instead of colons.)
Additionally, node will search in the following locations:
1: $HOME/.node_modules
2: $HOME/.node_libraries
3: $PREFIX/lib/node
Where $HOME is the user's home directory, and $PREFIX is node's configured node_prefix.
Does this bit about $PREFIX this still hold true? I can't find a reference to it in the code.
In lib/modules.js, it says
Module._initPaths = function() {
var isWindows = process.platform === 'win32';
if (isWindows) {
var homeDir = process.env.USERPROFILE;
} else {
var homeDir = process.env.HOME;
}
var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
if (homeDir) {
paths.unshift(path.resolve(homeDir, '.node_libraries'));
paths.unshift(path.resolve(homeDir, '.node_modules'));
}
if (process.env['NODE_PATH']) {
var splitter = isWindows ? ';' : ':';
paths = process.env['NODE_PATH'].split(splitter).concat(paths);
}
modulePaths = paths;
// clone as a read-only copy, for introspection.
Module.globalPaths = modulePaths.slice(0);
};
Maybe the refrence to node_prefix been replaced by this expression? path.resolve(process.execPath, '..', '..', 'lib', 'node');
Also
> process.config.variables.node_prefix
'out/dist-osx/usr/local'
This directory which does not exist. Maybe this variable is not used at runtime anymore? Or should I read this as a relative path (no / after all), which gets added to something else? If so, what?
Either way, the documentation doesn't make sense to me on this point.