Tags:Title:How to Safely Update Npm PackagesType:[[+]]Channel/Host:Coding in PublicReference:Publish Date:Creation Date:$= dv.current().file.ctimeLast Modified Date:$= dv.current().file.mtime
# Check what node versions are out there
nvm ls-remote
# Intall the version
nvm install 20.11.0
# Use the version
nvm use 20.11.0
# Set the default node version across terminals
nvm alias default 20.11.0
# Check
node -v
npm --versionNote: npm comes bundled with Node.js, so when you install a specific version of Node.js, it automatically includes a corresponding version of npm.
# Will install globally
npm install -g npm-check-updates# Will list packages that need updating
npx ncuOnly updates patches (e.g. 0.0.1 -> 0.0.23)
npx ncu -u -t patch
# Install to make sure everything is still working - will update package-lock.json
npm iUpdates minor versions (e.g. 0.3.0 -> 0.5.0)
npx ncu -u -t minor
# Install to make sure everything is still working - will update package-lock.json
npm iThese should be updated with caution as there may be breaking changes. Read release note docs to check how the changes will affect your project.
Updates major versions (e.g. 1.0.0 -> 2.0.0)
# Run on individual packages by using the `-f` or `-filter` flags
npx ncu -u -f axios
# Install to make sure everything is still working - will update package-lock.json
npm i🔗 Links to this page: [[Javascript]] [[npm]]