Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Node.js, PHP and APIs

npm install warns that inflight is unsupported and leaks memory, and bcrypt pulled it in

Your error

npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.3 more lines it can show

Fix it fast

Most common cause, 1 of 2

bcrypt 5 brings inflight in through @mapbox/node-pre-gyp

Upgrade to bcrypt 6, which removed node-pre-gyp and ships prebuilt binaries inside the package; it needs Node.js 18 or newer.

Fix
npm install bcrypt@^6.0.0

# npm 12, only if require('bcrypt') says no native build was found
npm install-scripts approve bcrypt
npm rebuild bcrypt
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

"npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory" is npm passing on the package's deprecation notice; the install still succeeds. In a bcrypt 5 project the chain is @mapbox/node-pre-gyp, rimraf 3, glob 7, inflight. bcrypt 6 replaced node-pre-gyp with bundled prebuilds, so upgrading on Node.js 18+ removes it (npm 11 and 12).

  • Applies to bcrypt 6.0.0, npm 11, npm 12.x, Node.js 22, 24 and 26
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Ask npm which of your direct dependencies drags inflight in. npm explain prints every path from the root project down to the package, so the top line of each chain names the dependency you control.

Run this first
npm explain inflight

Then find the line you see in this list and open its fix:

  1. 1bcrypt 5 brings inflight in through @mapbox/node-pre-gypnpm explain ends each chain at bcrypt@5.x, passing through @mapbox/node-pre-gyp, rimraf@3 and glob@7
  2. 2Another dependency still uses rimraf 3 or glob 7npm explain shows inflight under a package other than bcrypt, for example an older test runner, build tool or CLI

What does the error look like?

  • npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
  • npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it.
  • npm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supported
  • npm warn deprecated glob@7.2.3: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update.

Cause 1 of 2

bcrypt 5 brings inflight in through @mapbox/node-pre-gyp

You seenpm explain ends each chain at bcrypt@5.x, passing through @mapbox/node-pre-gyp, rimraf@3 and glob@7

Check

The inflight warning appears in bcrypt 5 projects because bcrypt 5.1.1 depends on @mapbox/node-pre-gyp 1.0.11, which needs rimraf 3; rimraf 3 needs glob 7, and glob 7 needs inflight. npm prints each deprecation it meets as a warning, which is why the inflight line arrives with the rimraf and glob notices. The warning is logged at warn level and does not stop the install.

Check
npm ls bcrypt
npm explain inflight | grep -B1 -A4 bcrypt

Fix

Upgrade to bcrypt 6, which removed node-pre-gyp and ships prebuilt binaries inside the package; it needs Node.js 18 or newer. On npm 12 its install script (node-gyp-build) is skipped until approved, which is fine where a bundled prebuild matches, because the loader picks it up at run time. Approve the script and rebuild only if the load fails with 'No native build was found'.

Fix
npm install bcrypt@^6.0.0

# npm 12, only if require('bcrypt') says no native build was found
npm install-scripts approve bcrypt
npm rebuild bcrypt

Verify

A fresh install prints no inflight warning, npm explain finds no path through bcrypt, and a hash call works.

Verify
npm explain inflight
node -e "require('bcrypt').hash('check', 10).then(h => console.log(h.slice(0, 7)))"

Confirmed by github.com

Did this fix it?

Cause 2 of 2

Another dependency still uses rimraf 3 or glob 7

You seenpm explain shows inflight under a package other than bcrypt, for example an older test runner, build tool or CLI

Check

Any package that still depends on rimraf 3 or glob 7 triggers the same warning, because glob 7.2.3 lists inflight among its own dependencies. The current glob and rimraf releases no longer depend on it. Read the top of each chain npm explain prints to find the package you can change.

Check
npm ls rimraf glob

Fix

Upgrade the package at the top of the chain to a release built on newer glob or rimraf, or swap it for a maintained alternative. When no such release exists yet, report it to its maintainers; the warning stays, but it does not break the install.

Fix
npm outdated
npm install --save-dev some-tool@latest

Verify

After the upgrade, npm explain inflight no longer lists that parent.

Verify
npm explain inflight

Confirmed by registry.npmjs.org

Did this fix it?

How do I stop it coming back?

  • Treat new deprecation warnings in CI logs as tickets: run npm explain on the package and note which direct dependency owns the chain.
  • Prefer native modules that bundle prebuilds, such as bcrypt 6, so installs do not depend on a separate download tool.
  • On npm 12, commit the allowScripts entries for native packages you approve, so every machine behaves the same.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: TaxiDex, Workforce.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.