Node Project not starting on the right path
When trying to start my Node Project, I got the error: "Error: Cannot find module '/app/dist/server.js'"
But my start command is: "npm run build && npx prisma migrate deploy && node ./dist/server.js"
I don't know where Railways is pulling that /app/ folder
23 Replies
Project ID:
ef969482-2fdd-4621-9512-7322fbaf5699
project files are placed inside an /app folder at the root of the container.
But my start command is: "npm run build && npx prisma migrate deploy && node ./dist/server.js"why do you have a build command in your start command?
I used to do that before using Railway, but I do have other project that uses the same command and works without issues
its far from best practice, the build should be ran during build, please remove it
sure, just a sec
I discovered something, now when I build typescript is maintaining the src folder
inside dist
this was not happening before
maybe this is the issue hahaha
will do some testing
definitely dont want to run a build in the start command regardless of the core issue here
there's any way I can check the file structure inside Railway?
there is no native filebrowser or ssh
😦
well still getting the same issue, even after removing the build command from the start
Error: Cannot find module '/app/dist/server.js'
if I try to build on my local machine
npm run build
and
npm run start
works as intended
well is npm run build being ran during build on railway?
looks like yes
using nixpacks right?
yes!
build logs please https://bookmarklets.up.railway.app/log-downloader/
one sec
and if you delete your local dist folder, and run a build, where does that dist folder get put?
oh, it's creating the server.js inside the src folder again
wtf
do you have any ideia why this is happening?
nope, please get the project working properly before you try running it on railway again
ok, thanks
ok, just managed to get it working now
since Prisma had an .ts file on it's folder
works on railway too?
well I just got the HTTP Server Running on deploy log
will test
but just in case anyone is using prisma, remember to exclude Prisma folder on your tsconfig