Railway crashes: Error: Cannot find module
ishayezagouri
TRIALOP

2 years ago

https://railway.app/project/f13891d7-ee1c-4246-8137-86bd38c12a01/logs?filter=%40deployment%3A75dd9713-581b-43f2-9818-a8909769eb42+-%40replica%3A37f3b258-0124-4f5c-b06d-62df61668581&start=1729636454244

node:internal/modules/cjs/loader:1143

throw err;

^

Error: Cannot find module 'node-cron'

Require stack:

  • /app/Backend/utils/cronJobs.js
  • /app/Backend/socket.js at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15) at Module._load (node:internal/modules/cjs/loader:981:27) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at Object. (/app/Backend/utils/cronJobs.js:6:14) at Module._compile (node:internal/modules/cjs/loader:1364:14) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) { code: 'MODULENOTFOUND', requireStack: [ '/app/Backend/utils/cronJobs.js', '/app/Backend/socket.js' ]

}

even if i comment out require('./utils/cronJobs'); in my socket js the problem just moves on to the next required module in the file.

Github repo:

https://github.com/IshayEzagouri/ParkNow/tree/main

thanks!

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

8 Replies

ishayezagouri
TRIALOP

2 years ago

Anyone?



ishayezagouri
TRIALOP

2 years ago

yes i do

https://github.com/IshayEzagouri/ParkNow/blob/main/Backend/package.json

thing is it does that for any dependency on my socket.js file

if i comment out the cron import it'll just show the same error for the next one


2 years ago

Is this a shared monorepo?


ishayezagouri
TRIALOP

2 years ago

Is this a shared monorepo?

yeah man

it has a web backend folder as well as web frontend and arduino backend

all in the same repo


2 years ago

Then the root package.json needs to also have the needed dependencies.


ishayezagouri
TRIALOP

2 years ago

Then the root package.json needs to also have the needed dependencies.

Thanks that seemed to work.

Although i got another error now which i'm not able to solve:

/app/node_modules/.prisma/client/default.js:43

Oct 30 18:16:57

throw new Error('@prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.');

Oct 30 18:16:57

^

Oct 30 18:16:57

Oct 30 18:16:57

Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.

this is my railway.toml:

[services.backend]

command = "cd Backend && rm -rf node_modules && npm install && npx prisma generate"

start = "cd Backend && npm run start"

[services.frontend]

command = "cd Frontend && npm install && npm run build"

start = "cd Frontend && npm start"

Sorry if it's a dumb question- i'm a student and it's my first time using railway.


2 years ago

Are you running prisma generate like the error message suggests?

Thats also not a valid railway.toml file.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...