Error: Cannot find module ‘express’
Oct 11 05:40:54 PM Require stack:
Oct 11 05:40:54 PM - /opt/render/project/src/index.js
Oct 11 05:40:54 PM at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
Oct 11 05:40:54 PM at Module._load (node:internal/modules/cjs/loader:901:27)
Oct 11 05:40:54 PM at Module.require (node:internal/modules/cjs/loader:1115:19)
Oct 11 05:40:54 PM at require (node:internal/modules/helpers:130:18)
Oct 11 05:40:54 PM at Object. (/opt/render/project/src/index.js:5:17)
Oct 11 05:40:54 PM at Module._compile (node:internal/modules/cjs/loader:1241:14)
Oct 11 05:40:54 PM at Module._extensions…js (node:internal/modules/cjs/loader:1295:10)
Oct 11 05:40:54 PM at Module.load (node:internal/modules/cjs/loader:1091:32)
Oct 11 05:40:54 PM at Module._load (node:internal/modules/cjs/loader:938:12)
Oct 11 05:40:54 PM at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) {
Oct 11 05:40:54 PM code: ‘MODULE_NOT_FOUND’,
Oct 11 05:40:54 PM requireStack: [ ‘/opt/render/project/src/index.js’ ]
Oct 11 05:40:54 PM }
Hi,
You’ve not provided much information here, but the error:
Error: Cannot find module ‘express’
Implies you haven’t installed your dependencies, e.g. npm install
.
Alan
Hi,
I’m a bigginer developer, what other information do I need to share?
The setup from deploy I’ve setted:
Build Command: npm install,
Start Command: node index.js
I’ve also defined the node version to perform the same version I used in this project
In environment: NODE_VERSION : 20.7.0
Ok, so if you’re running npm install
, and it’s still showing the same error - is “express” listed in your package.json
dependencies?
Alan
Yes, express is listed on package.json. My app is working fine in localhost.
There will always be differences between environments: development mode/Local, production mode/Render, etc. These differences need to be considered and configured as required for your own app in each environment.
Are you able to provide more information? Maybe a link to the repo (if public)?
Alan
Sure. This is the link:
express
isn’t explicitly defined as a dependency in your package.json
https://github.com/LuizHMMoraes/rpg-finder/blob/main/package.json
Alan
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.