Node.js - React - Next.js
Appearance
Node.js
On Ubuntu 25, the clean and reliable way to handle multiple Node.js versions is to use NVM (Node Version Manager).
18 (18.20.8) → LTS: Safe, widely compatible
20 (20.20.0) → LTS: Mature, very stable. A good choice today
22 (22.22.0) → LTS: Also stable. A good choice today
24 → LTS: Early adopter / forward-looking
Install nvm
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash # Lasted
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # If you want a specific version
source ~/.bashrc
nvm -v
nvm commands
nvm install 18 # Install multiple Node versions
nvm install 20.20.0
nvm ls # List versions
nvm uninstall 20.20.0 # Remove versions
nvm alias default 20.20.0 # Set a default
nvm use default # Set the one used on the current terminal
nvm use 18 # Switch versions
nvm use 20.20.0
# Per-project version. Inside a project directory:
cd mi_proyecto
echo "20.20.0" > .nvmrc
nvm use
npm install
npm / npx commands
npx create-next-app@latest
npx create-next-app@14.2.5
npm install
npm install @mui/material
npm install @mui/material@5.15.14
npm uninstall @mui/material
# To recreated node_module:
rm -rf node_modules
rm package-lock.json # Only in some particular cases
npm install
npm run dev # To run the app
npm run dev -- -p 3000
npx depcheck # To check unused and missing libreries
package-lock.json
- Records the exact dependency tree that was installed: Exact versions (no ranges), Exact sub-dependencies, Resolved URLs, Integrity hashes
- So, when you run npm install: npm does not guess - npm recreates the same tree every time.
- So, package-lock.json exists to: Prevent dependency chaos, Make builds reproducible, Save you from random breakage