Why Use Third-Party Libraries
How to Evaluate a Package
Check these indicators before runningnpm install:
Essential Backend Libraries
Memorize this table. These are tested in exams.Installing Packages
package.json vs package-lock.json
package-lock.json ensures every developer and every deployment gets exactly the same versions. Never delete it.Semantic Versioning (Semver)
npm packages useMAJOR.MINOR.PATCH:
Version Prefixes in package.json
Security and Maintenance
npm audit
Check and Update Packages
Full Example: Express + cors + helmet
Key Terms
Common Mistakes
Committing node_modules to Git
Committing node_modules to Git
node_modules is large, platform-specific, and regenerable. Always add it to .gitignore. Only commit package.json and package-lock.json.
Ignoring npm audit warnings
Ignoring npm audit warnings
High-severity vulnerabilities can expose your entire application. Run npm audit in your CI pipeline and fail the build on critical findings.
Installing a runtime package as devDependency
Installing a runtime package as devDependency
If bcrypt is in devDependencies, it won’t be installed in production with
npm install --production and your app will crash. Double check —save-dev vs regular install.Running npm audit fix --force without testing
Running npm audit fix --force without testing
Forced fixes can upgrade major versions with breaking changes. Always run your test suite after force-fixing.