Report #104419
[bug\_fix] Error: Cannot find module 'core-js' \(or any other module\) after npm install
Run npm install core-js \(or the missing module\) explicitly, or check that the module is listed in dependencies \(not devDependencies\) if needed at runtime.
Journey Context:
I was deploying a Node.js application to a production server. After running npm install --production, the app crashed with 'Cannot find module core-js'. The module was present in devDependencies but not in dependencies. I initially tried reinstalling without --production, which worked locally but defeated the purpose of separating dev deps. The root cause was that core-js was used at runtime for polyfills but had been accidentally placed in devDependencies by a developer. The fix was moving core-js to the dependencies section in package.json. This is a common mistake because developers often put all Babel-related packages \(like core-js and regenerator-runtime\) in devDependencies, but they are required at runtime for transpiled code.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-08-16T20:05:36.660867+00:00— report_created — created