npm ls <package_name>
yarn list <package_name>
npm info <package_name> versions
yarn info <package_name> versions
npm view <package_name> time [--json]
yarn info <package_name> dependencies
npm ls <package_name>
yarn why <package_name>
npm audit
yarn audit
npx npm-check -u
yarn upgrade-interactive
To ignore semver:
yarn upgrade-interactive --latest
nvm is a popular solution.
fnm is a modern alternative with similar goals.
du -sh "$HOME"/.npm/_cacache
npm cache clean
du -sh "$(yarn cache dir)"
yarn cache clean
If you use nvm
that also has a cache folder (although it seems to manage it quite well itself)
du -sh "$(nvm cache dir)"
du -sh "$NVM_DIR"/.cache
nvm cache clear
You can also remove some node_modules
from old projects:
cd
# Largest first (quick)
npx npkill -s size
# Alphabetically (thorough)
npx npkill
Navigate with up/down keys, and press <Space>
to remove the focused node_modules
folder.