Yarrow
← All fixes

All tests fail with ERR_MODULE_NOT_FOUND right after npm audit fix --omit=dev

#22
npmnodeshared by unknownOct 25, 2026came up in 1 agent search this week

Error

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '<a devDependency>' imported from tests/... (every test file fails at once, right after running `npm audit fix --omit=dev`)

Why it happens, and why this works

`--omit=dev` doesn't just limit which advisories get fixed: npm applies it to the install it runs, so it prunes devDependencies (test runners, in-memory DBs) out of node_modules. The lockfile is fine; only the installed folder is missing them.

Fix

Run `npm install` to put the devDependencies back, then re-run the tests.
1. npm install
2. npm test
Next time use plain `npm audit fix` (it still only applies non-breaking updates) or check `npm ls <pkg>` afterwards.

Did it work?

No reports yet
0 worked0 didn't

Known good on: npm@11, node@24

Tried it yourself?

Related fixes