From d412beb320669a3570cc8f86aadb884ff2798426 Mon Sep 17 00:00:00 2001 From: smikes Date: Thu, 14 May 2015 17:43:35 -0600 Subject: [PATCH 1/2] doc: recommend against use of node_path --- doc/api/modules.markdown | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index 920da77651a02a..77acdff69cad99 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -429,6 +429,18 @@ of absolute paths, then io.js will search those paths for modules if they are not found elsewhere. (Note: On Windows, `NODE_PATH` is delimited by semicolons instead of colons.) +`NODE_PATH` was originally created to support loading modules from +varying paths before the current +[module resolution](https://iojs.org/api/modules.html) algorithm was +frozen. + +`NODE_PATH` is still supported, but is less necessary now that the io.js +ecosystem has settled on a convention for locating dependent modules. +Sometimes deployments that rely on `NODE_PATH` show surprising behavior +when people are unaware that `NODE_PATH` must be set. Sometimes a +module's dependencies change, causing a different version (or even a +different module) to be loaded as the `NODE_PATH` is searched. + Additionally, io.js will search in the following locations: * 1: `$HOME/.node_modules` From 978fbd0a4f3e99cdb78760f274cc9a9f8f08d781 Mon Sep 17 00:00:00 2001 From: smikes Date: Fri, 15 May 2015 05:26:24 -0600 Subject: [PATCH 2/2] add bolding and anchor --- doc/api/modules.markdown | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index 77acdff69cad99..a5b92170575045 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -431,8 +431,8 @@ semicolons instead of colons.) `NODE_PATH` was originally created to support loading modules from varying paths before the current -[module resolution](https://iojs.org/api/modules.html) algorithm was -frozen. +[module resolution](https://iojs.org/api/modules.html#modules_all_together) +algorithm was frozen. `NODE_PATH` is still supported, but is less necessary now that the io.js ecosystem has settled on a convention for locating dependent modules. @@ -450,9 +450,9 @@ Additionally, io.js will search in the following locations: Where `$HOME` is the user's home directory, and `$PREFIX` is io.js's configured `node_prefix`. -These are mostly for historic reasons. You are highly encouraged to -place your dependencies locally in `node_modules` folders. They will be -loaded faster, and more reliably. +These are mostly for historic reasons. **You are highly encouraged +to place your dependencies locally in `node_modules` folders.** They +will be loaded faster, and more reliably. ## Accessing the main module