mirror of https://github.com/nodejs/node.git
Add ~/.node_modules as well as ~/.node_libraries
parent
b0adaff67e
commit
5e14c8bec0
|
@ -3241,15 +3241,15 @@ Without the leading `'./'`, like `require('assert')` the module is searched
|
|||
for in the `require.paths` array. `require.paths` on my system looks like
|
||||
this:
|
||||
|
||||
`[ '/home/ryan/.node_libraries' ]`
|
||||
`[ '/home/ryan/.node_modules' ]`
|
||||
|
||||
That is, when `require('foo')` is called Node looks for:
|
||||
|
||||
* 1: `/home/ryan/.node_libraries/foo`
|
||||
* 2: `/home/ryan/.node_libraries/foo.js`
|
||||
* 3: `/home/ryan/.node_libraries/foo.node`
|
||||
* 4: `/home/ryan/.node_libraries/foo/index.js`
|
||||
* 5: `/home/ryan/.node_libraries/foo/index.node`
|
||||
* 1: `/home/ryan/.node_modules/foo`
|
||||
* 2: `/home/ryan/.node_modules/foo.js`
|
||||
* 3: `/home/ryan/.node_modules/foo.node`
|
||||
* 4: `/home/ryan/.node_modules/foo/index.js`
|
||||
* 5: `/home/ryan/.node_modules/foo/index.node`
|
||||
|
||||
interrupting once a file is found. Files ending in `'.node'` are binary Addon
|
||||
Modules; see 'Addons' below. `'index.js'` allows one to package a module as
|
||||
|
|
|
@ -137,6 +137,7 @@ var module = (function () {
|
|||
// Lowest priority.
|
||||
var defaultPaths = [];
|
||||
if (process.env.HOME) {
|
||||
defaultPaths.push(path.join(process.env.HOME, ".node_modules"));
|
||||
defaultPaths.push(path.join(process.env.HOME, ".node_libraries"));
|
||||
}
|
||||
defaultPaths.push(path.join(process.execPath, "..", "..", "lib", "node"));
|
||||
|
|
Loading…
Reference in New Issue