Browse Source

Add ~/.node_modules as well as ~/.node_libraries

v0.7.4-release
isaacs 14 years ago
committed by Ryan Dahl
parent
commit
5e14c8bec0
  1. 12
      doc/api.markdown
  2. 1
      src/node.js

12
doc/api.markdown

@ -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 for in the `require.paths` array. `require.paths` on my system looks like
this: this:
`[ '/home/ryan/.node_libraries' ]` `[ '/home/ryan/.node_modules' ]`
That is, when `require('foo')` is called Node looks for: That is, when `require('foo')` is called Node looks for:
* 1: `/home/ryan/.node_libraries/foo` * 1: `/home/ryan/.node_modules/foo`
* 2: `/home/ryan/.node_libraries/foo.js` * 2: `/home/ryan/.node_modules/foo.js`
* 3: `/home/ryan/.node_libraries/foo.node` * 3: `/home/ryan/.node_modules/foo.node`
* 4: `/home/ryan/.node_libraries/foo/index.js` * 4: `/home/ryan/.node_modules/foo/index.js`
* 5: `/home/ryan/.node_libraries/foo/index.node` * 5: `/home/ryan/.node_modules/foo/index.node`
interrupting once a file is found. Files ending in `'.node'` are binary Addon 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 Modules; see 'Addons' below. `'index.js'` allows one to package a module as

1
src/node.js

@ -137,6 +137,7 @@ var module = (function () {
// Lowest priority. // Lowest priority.
var defaultPaths = []; var defaultPaths = [];
if (process.env.HOME) { 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.env.HOME, ".node_libraries"));
} }
defaultPaths.push(path.join(process.execPath, "..", "..", "lib", "node")); defaultPaths.push(path.join(process.execPath, "..", "..", "lib", "node"));

Loading…
Cancel
Save