deployment crashes and says 'Error: Cannot find module '/app/index.js''

me again, so my bot worked for like one min but then the deployment stopped working and gave me that error. idk why when it should work fine. https://github.com/st1xkz/jarvis
34 Replies
Percy
Percy2y ago
Project ID: 6173f88e-f2da-469e-94c6-14d7c275c967
lucy💫
lucy💫2y ago
6173f88e-f2da-469e-94c6-14d7c275c967
angelo
angelo2y ago
Yep, as its an issue with your project, I can't help here. The reason why you may have not gotten a reply is 1. You didn't provide enough information inline such as logs 2. You might wanna share the error you faced The more you've shown that you attempted a meaningful debugging on your end, usually I see the community engaging.
lucy💫
lucy💫2y ago
Ight I’ll do that This is the full error it gave me
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '/app/index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module '/app/index.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:22:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
angelo
angelo2y ago
Very likely a package you were using updated and left ya in the lurch.
lucy💫
lucy💫2y ago
I followed the djs guide so I don’t think anything should be wrong really
angelo
angelo2y ago
What node version do you use locally? vs. the one Railway is reporting?
lucy💫
lucy💫2y ago
Uhh I think the latest one Idrk and idk how to check I’ll check in a bit though
Finn
Finn2y ago
what is your start command ( found at the top fo the build logs )? i would probbally just add a start script to your package.json tbh
"start": "node src/index.js"
"start": "node src/index.js"
`
lucy💫
lucy💫2y ago
node index.js
Finn
Finn2y ago
cool so add the start thing to your scripts section of your package.json and it shoudlw rok
lucy💫
lucy💫2y ago
Is it cuz of this?
Finn
Finn2y ago
that would cause issues yeah
lucy💫
lucy💫2y ago
So I would change that to node src/index.js?
Finn
Finn2y ago
yeah if you want i would say the package.json route is more standard though
lucy💫
lucy💫2y ago
Now it’s saying this
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- /app/src/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/app/src/index.js:5:19)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/src/index.js' ]
}
node:internal/modules/cjs/loader:988
throw err;
^
Error: Cannot find module './config.json'
Require stack:
- /app/src/index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/app/src/index.js:5:19)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/app/src/index.js' ]
}
And the config.json file is for my bot token And it’s not in a folder or anything
Finn
Finn2y ago
thats beacuse you need to import it from the right location. I guess set your start command to be cd src && node index.js but thats not ideal
lucy💫
lucy💫2y ago
I thought I did..
lucy💫
lucy💫2y ago
GitHub
GitHub - st1xkz/jarvis: A basic Discord bot I made whilst learning ...
A basic Discord bot I made whilst learning JavaScript. - GitHub - st1xkz/jarvis: A basic Discord bot I made whilst learning JavaScript.
Finn
Finn2y ago
no you set it to node index.js`` i asume locally you cd to the src dir and run node index.js`
lucy💫
lucy💫2y ago
I just changed the start command to node src/index.js
Finn
Finn2y ago
again im saying it should be cd src && index.js if your getting an import issue with node src/index.js
lucy💫
lucy💫2y ago
lucy💫
lucy💫2y ago
?
Finn
Finn2y ago
oops i miss typed cd src && node index.js
lucy💫
lucy💫2y ago
Still giving same error
Finn
Finn2y ago
how do you run this locally?
lucy💫
lucy💫2y ago
Wym
Finn
Finn2y ago
how do you test this locally? on your pc
lucy💫
lucy💫2y ago
I use gitpod I don’t have anything locally
Finn
Finn2y ago
how do you run this on gitpod?
lucy💫
lucy💫2y ago
I still don’t understand what you mean
Finn
Finn2y ago
when you are developing and writing your code. how do you know it runs? if you dont know if it runs at all i would advise you to get it up and running in your development environment of choice ( gitpod i guess ), then it should be clear how to get it running on railway
Want results from more Discord servers?
Add your server