← All errors · ReplitNode & Python runtime errors
Error: Cannot find module 'express'
Exact error
Error: Cannot find module 'express' Require stack: ... code: 'MODULE_NOT_FOUND'
What it means
Node can't find a package (or local file) you required.
Likely causes
- Dependencies not installed in this environment.
- Package not listed in package.json.
- Wrong relative path for a local file.
How to fix it
Install and save the dependency:
npm install expressFor a local file, check the relative path, e.g. require('./routes/users') from the right directory.
Still stuck after trying this? Get it fixed for $49, or you don't pay.
Prevent this next time
- Commit package-lock.json or requirements.txt so every environment installs the same dependencies.
- Read the port from `process.env.PORT` and bind to 0.0.0.0 in hosted environments.
Guide: catch outages before your users do.
Tools that help:
- Better Stack: Uptime, cron/heartbeat monitoring and log alerts.
Some links on this page are affiliate links: if you sign up or buy through them, FixStack may earn a commission at no extra cost to you. Learn more.
FAQ
What does "Error: Cannot find module 'express'" mean?
Node can't find a package (or local file) you required.
What usually causes it?
Dependencies not installed in this environment. Package not listed in package.json. Wrong relative path for a local file.
How do I fix it?
1. Install and save the dependency: 2. For a local file, check the relative path, e.g. require('./routes/users') from the right directory.
Related errors
More Replit errors and fixes →
Tools that help
- Railway: Deploy backends and databases; new users get $20 credit.
Some links on this page are affiliate links: if you sign up or buy through them, FixStack may earn a commission at no extra cost to you. Learn more.
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy