Latest LTS Version: 18.12.1 (includes npm 8.19.2) — https://nodejs.org/en/download/
https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md
"engines" : {
"npm" : ">=8.0.0 <9.0.0",
"node" : ">=16.0.0 <17.0.0"
}
So if you see ~1.0.2 it means to install version 1.0.2 or the latest patch version such as 1.0.4. If you see ^1.0.2 it means to install version 1.0.2 or the latest minor or patch version such as 1.1.0.
=
- fixed version (1.0.2)~
- patches only (1.0.2, 1.0.4)^
- monor only (1.0.2, 1.1.0)
sudo npm install npm@latest -g
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
or with NVM:
nvm install stable
Install locked dependences
rm -rf node_modules/ && npm cache verify && npm ci
Refresh lock file
rm -rf node_modules/ package-lock.json && npm cache verify && npm install
npx npm-check-updates -g
npm i --package-lock-only && npm audit; rm -f package-lock.json
rm -rf .git/hooks && npm rebuild
npx babel-upgrade --write
Audit
npm audit fix --audit-level critical
- Critical: Highest severity that requires immediate attention.
- High: These findings need developers to address them urgently.
- Moderate: These findings are of medium severity and developers have more time to address them.
- Low: These findings are of the lowest severity and developers can remediate them at their convenience.
NCU
npx npm-check-updates -u
Outdated
npm outdated
Douples
npm find-dupes
npm dedupe