Skip to content
Web Design & Development

A Practical Guide to Managing npm Dependencies

Handling JavaScript package dependencies, versions and security in Node.js and front-end projects.

MediaScaleUp Editorial Team 2 min read 13 views
A Practical Guide to Managing npm Dependencies

What is at stake

JavaScript projects pull in large dependency trees, which carry both maintenance and security risk.

The playbook

  1. Commit lock files
  2. Use clean installs in CI
  3. Audit dependencies regularly
  4. Review new dependencies before adding them
  5. Prefer fewer, well-maintained packages

Where it goes wrong

Avoid:

  • Installing packages without review
  • Ignoring audit warnings indefinitely
  • Running scripts from untrusted packages
  • Huge dependency trees for small tasks
What to do and what to avoid with managing npm dependencies, side by side
Good practice against the usual mistakes, from the sources listed below.

The numbers behind it

Published figures for Managing npm Dependencies
MeasureFigure
package-lock.jsonpins the exact installed tree
npm auditreports known vulnerabilities
Transitive dependenciesmost packages come from other packages
Supply chaincompromised packages have affected many projects

Getting outside help

When to hand it over: Bring in help when dependency security needs auditing.

Where this comes from

  • Node.js — Dependency management
  • OWASP — Vulnerable Dependency Management Cheat Sheet

The figures and practices above come from the sources listed.

Working on something like this?

We take on Web Design & Development work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

MediaScaleUp Editorial Team

Articles here are researched, written and checked by the MediaScaleUp studio team before they are published, and dated when they are reviewed.

Keep reading

More in Web Design & Development