Techtrekking

How to setup Node.js using nvm on Ubuntu server

By Pravin

Install nvm and correct node version

sudo apt update # install pre-requisite sudo apt install curl build-essential -y # install nvm curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # load to current shell export NVM_DIR="$HOME/.nvm" source "$NVM_DIR/nvm.sh" # ensure below lines exists in sudo nano ~/.bashrc: export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # reload ~/.bashrc source ~/.bashrc # install specific node version # Next.js recommends 24.13 LTS version for latest nextjs v16 nvm install 24.13
Comments
No comments yet. Be the first to comment!
Leave a Comment
Your comment will be visible after approval.