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 showFix it fast
Most common cause, 1 of 2bcrypt 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.
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 bcryptShort 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).
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.
npm explain inflightThen find the line you see in this list and open its fix:
- 1bcrypt 5 brings inflight in through @mapbox/node-pre-gyp
npm explain ends each chain at bcrypt@5.x, passing through @mapbox/node-pre-gyp, rimraf@3 and glob@7 - 2Another dependency still uses rimraf 3 or glob 7
npm 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 supportednpm 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.
npm ls bcrypt
npm explain inflight | grep -B1 -A4 bcryptFix
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'.
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 bcryptVerify
A fresh install prints no inflight warning, npm explain finds no path through bcrypt, and a hash call works.
npm explain inflight
node -e "require('bcrypt').hash('check', 10).then(h => console.log(h.slice(0, 7)))"Confirmed by github.com
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.
npm ls rimraf globFix
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.
npm outdated
npm install --save-dev some-tool@latestVerify
After the upgrade, npm explain inflight no longer lists that parent.
npm explain inflightConfirmed by registry.npmjs.org
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.