package.json & requirements.txt Viewer · Tutorial

How to review npm dependencies in a package.json

6 min readbeginnerUpdated

A teammate opened a pull request that changes package.json. Before you approve it, you want to know whether any dependency could pull in an unexpected major version. You will paste the file and work through the flagged entries.

What you need

Steps

  1. Paste the file

    Load the example. The summary shows 12 dependencies, several of them worth checking.

  2. Show only the flagged entries

    Tick Only show entries worth checking. lodash accepts any version, vite has no upper limit, chart-lib comes from GitHub and react appears in both dependency lists.

  3. Fix loose ranges

    Replace * and >=6 with caret ranges such as ^4.17.21 and ^6.3.0. Paste the new values into the Semver Checker if you are unsure what they allow.

    "lodash": "^4.17.21",
    "vite": "^6.3.0"
  4. Remove the duplicate

    A package needed at runtime belongs in dependencies only. Delete react from devDependencies.

  5. Decide about Git dependencies

    github:northwind/chart-lib#v2.1.0 is pinned to a tag, which is reasonable. A branch name instead of a tag would change under you; publish the package to a registry if you can.

Try it yourself

Opens the package.json & requirements.txt Viewer with this tutorial's sample loaded.

Try it now

Common mistakes

Ignoring the lock file
The lock file decides what is installed today. Loose ranges matter when it is regenerated, for example after npm update or in a new project.
Pinning everything in a library
Exact versions in a published library force duplicate copies on its users. Pin in applications, use ranges in libraries.

Next steps

Go back to the package.json & requirements.txt Viewer, or keep going with one of these: