Safeguard
Supply Chain•

npm min-release-age or before: how do you delay new versions?

npm has two config options for ignoring very new package versions. How min-release-age and before differ, which wins, and when each one fits.

Safeguard Security Team
3 min read

Use min-release-age to ignore versions published fewer than a set number of days ago, and use before to freeze resolution at a fixed date. The npm docs say that if both are set in the same source, before takes precedence. Check that your npm version supports them.

What the npm config reference says

min-release-age (default null, a number): with a value set, npm installs only versions that were available more than the given number of days ago. If no eligible version exists, the command errors. Packages matching min-release-age-exclude are exempt. The page says the setting is not passed to child processes.

before (default null, a date): npm rebuilds the dependency tree so that only versions available on or before the given date are installed. If before and min-release-age are both set in the same source, before takes precedence.

The reference does not say in which npm release either option arrived, so confirm in your environment.

Choosing between them

NeedUse
A rolling delay, such as nothing newer than a weekmin-release-age
Reproduce an old build from a known datebefore
Exempt an internal package from the delaymin-release-age-exclude
Fail loudly if nothing old enough existsmin-release-age (it errors)

Why delay at all

Compromised releases are often detected and pulled within a short window. A delay means your resolver skips the newest versions until others have had time to notice a problem. The longer discussion, with its limits, is in dependency cooldown periods as a malware defense. A delay is not a guarantee, since a bad version might survive past your window.

Delay and security fixes

The risk of a delay is that a patch for a known vulnerability is also new. If your policy applies blindly, you wait for the fix. Plan an exception route:

  1. Keep the delay short enough that an urgent fix is at most days away.
  2. Use the exclude list for the specific package while you review the new release.
  3. Record each exception with the advisory and the reviewer.
  4. Remove the exclusion afterwards so the default applies again.

Setup steps

  1. Pick a number of days. A few days to a week is a common starting point, and your team's tolerance decides.
  2. Add min-release-age to the project .npmrc and commit it.
  3. Run a clean install in CI to see which resolutions change.
  4. Fix any "no eligible version" errors by choosing an older range or an exception.
  5. Decide who approves exclusions.
  6. Review the number every quarter.

What it does not change

The setting affects resolution of versions that npm picks. It does not alter versions already pinned in a lockfile, and npm ci installs what the lockfile says. Delay applies when you update. That is why lockfile review stays important, see what to check in a lockfile diff.

Safeguard scans your lockfile and monitors for new advisories on pinned versions, so a delayed fix does not go unnoticed. A free scan shows your current state.

Quick check

Which wins if both are set?

before, if both are set in the same source, per the npm config reference.

Does min-release-age change an existing lockfile?

Not by itself. It affects which versions npm resolves when it updates. npm ci installs what the lockfile records.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.