# Node apps

# Lazy-loading nvm

Since v3.1.44 it is possible to initialize nvm helper code on first-run thus improving shell load times. Set LAZY_LOAD_NODE=1 in ~/.bashrc. A first-time invocation of node, npm, or nvm will initialize nvm code, shimming the path as needed.

# Selecting Node versions

It is strongly recommended to select a Node version other than system default. LTS (opens new window) is typically recommended for maximum compatibility with packages on npm.

Example: changing Node versions:

# List remote Nodes
nvm ls-remote
# Install LTS release "boron" (6.11)
nvm install lts/boron

# Troubleshooting

# Memory allocation failure

Complex pipeline builds may fail with out-of-memory errors, e.g. RangeError: WebAssembly.Instance(): Out of memory: wasm memory or Fatal process out of memory: Failed to reserve virtual memory for process-wide V8 pointer compression cage.

This is related to a virtual allocation failure (nodejs/node#25933 (opens new window)) Removing the virtual memory limit, intended as a safety limit, resolves this issue.

ulimit -v unlimited
# Run command again
npm run build