Node - NODE_PATH

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.)

Syntax

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

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);

Documentation / Reference


Powered by ComboStrap