Node - NODE_PATH

> (World Wide) Web - (W3|WWW) > Javascript (Js|ECMAScript) > Node.js

1 - About

NODE_PATH is a node environment variable where module will be searched by the module loader when using a:

Additionally, Node.js will search in the following list of GLOBAL_FOLDERS:

  • 1: $HOME/.node_modules
  • 2: $HOME/.node_libraries
  • 3: $PREFIX/lib/node ($PREFIX is Node.js's configured node_prefix.)
Advertising

3 - Syntax

  • Linux
NODE_PATH=path[:…]
  • Windows
NODE_PATH=path[;…]

4 - Snippet

process.env.NODE_PATH = (process.env.NODE_PATH || '')
  .split(path.delimiter)
  .filter(folder => folder && !path.isAbsolute(folder))
  .map(folder => path.resolve(appDirectory, folder))
  .join(path.delimiter);

5 - Documentation / Reference

web/javascript/node/node_path.txt · Last modified: 2019/03/19 11:07 by gerardnico