Install
Ubuntu / Debian:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
apt-get install -y nodejs
CentOS / Red Hat
curl -sL https://rpm.nodesource.com/setup_14.x | sudo -E bash -
yum install -y nodejs
WSL
WSL1 里 npm 安装某些包可能报错 "npm ERR! Error: EACCES: permission denied"
Workaround: npm config set unsafe-perm=true
Tips & Solutions
Runtime memory limit (JavaScript heap out of memory error)
Fix:
# Set heap memory limit to 8192 MB
node --max-old-space-size=8192 index.js
// or
export NODE_OPTIONS=--max-old-space-size=8192
node index.js