Complete guide to installing Node.js on Windows, macOS, and Linux. Learn about version managers, building from source, and verifying your installation.
# List available versionsnvm list available# Install latest LTSnvm install lts# Install specific versionnvm install 20.11.0# Use installed versionnvm use 20.11.0# List installed versionsnvm list
Developer Mode requirementOn Windows, creating symlinks requires Developer Mode to be enabled or running as Administrator. Some tests may fail without proper permissions.
# Install Homebrew if you haven't already/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"# Install Node.js LTSbrew install node@20# Or install current versionbrew install node# Link the installed versionbrew link node@20
# Install latest LTSnvm install --lts# Install specific versionnvm install 20.11.0# Use installed versionnvm use 20.11.0# Set default versionnvm alias default 20.11.0# List installed versionsnvm ls
# Install n globally using npm (requires Node.js to be installed first)npm install -g n# Or install n without Node.jscurl -L https://bit.ly/n-install | bash# Install LTS versionn lts# Install latest versionn latest# Install specific versionn 20.11.0# List installed versionsn ls
# Download and run NodeSource setup scriptcurl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -# Install Node.jssudo dnf install -y nodejs# Or for older systems using yumsudo yum install -y nodejs
# Install to custom directory./configure --prefix=/opt/nodejs# Build with debug symbols./configure --debug# Build without internationalization support./configure --without-intl# Build with small ICU (English only)./configure --with-intl=small-icu# Build without OpenSSL assembly optimization./configure --openssl-no-asm# Enable Address Sanitizer for debugging./configure --enable-asan
# If installed via Homebrewbrew uninstall node# If installed via official installersudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
If you encounter permission errors when installing global packages:
# Don't use sudo with npm!# Instead, configure npm to use a different directorymkdir ~/.npm-globalnpm config set prefix '~/.npm-global'# Add to your shell profileexport PATH=~/.npm-global/bin:$PATH