a year ago
anyone recently having issue with date-fns in railway? my latest deployment is not working due to error
Error: Cannot find module '/app/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry
But checking the node_modules manually. the packages files including index.js is found
What's weird is that, this only happen today. yesterday the deployment work fine
0 Replies
a year ago
please share your repo
this was the green deployment yesterday
https://railway.app/project/d85df9df-e8f2-42e7-81ea-4e1929823be4/service/04f7bad6-9243-4163-81f6-648ad8ec8daf?id=1159acdc-9143-4376-b5f2-f62b0b9ee70c
the strange is that, there is no other update really. and if i try to re deploy using the same code base (no update) the issue will show up
a year ago
this is unlikely to be a specific railway issue
a year ago
Error: Cannot find module '/app/node_modules/date-fns/index.js'. Please verify that the package.json has a valid "main" entry
Please verify that the package.json has a valid "main" entry
have you done this?
a year ago
another reason this could be happening, are you commiting your node_modules folder to github?
yeah, I thought of that as well that its not a railway issue. but what bugs me is that it just happen with todays deployments
a year ago
Please verify that the package.json has a valid "main" entry
a year ago
please provide a build log from the working build. and then a build log from the most recent broken build.
a year ago
that is the deploy logs, please provide build logs
im seeing "No build logs found for deployment" with working build. few min I will revert to this build and see if build logs will be populated
a year ago
sounds good
a year ago
in the mean time, please send the build logs for the newest broken build
done reverting the working build. I see "No build logs found for deployment" still. maybe this is because it has been build before and was pulled from cache now?
a year ago
can you revert your repo to the point in time the last successful deployment was made?
I did that earlier and able to experienced the issue. but I will try again now for you
a year ago
do you have the date from when you made the last successful deployment? (not a revert)
a year ago
you reverted the repo to before feb 28th?
on i've reverted on that date(feb 28). that's the first time I deploy this project in railway
btw, a note as well. I have other project using date-fns deployed in railway - been running almost a year already
now with this error. im afraid if we deploy to the other project might have the same issue 😄
a year ago
can you try deleting your yarn lock file and then re-syncing it
a year ago
you can bring your repo back up to date now
a year ago
would you happen to know the node version in use by the last working build?
but earlier while debuggin. I logged in server from my local using cli. I checked the node version in server and setup the same version in my local. Im not able to experience the same error in my local
a year ago
the cli does not allow you to "log in" to the container
a year ago
you where running commands locally
a year ago
that runs the command locally
a year ago
does the package.json have a valid main entry now?
a year ago
would you be willing to add me to the repo?
a year ago
brody192
a year ago
what branch is railway set to deploy from?
a year ago
is dist/main.js
the correct path to the generated file?
a year ago
is this the path the main.js file ends up being put locally?
a year ago
wait why is date-fns being used?
a year ago
have you told me your local node version?
a year ago
as far as i know, railway would be using node 18.19
a year ago
just some tiny config issue, its a tricky one
a year ago
your start script is nest start
are you sure this is running the built main.ts file?
maybe try changing your start command on railway to your start:prod
script?
a year ago
updating the target in your tsconfig.json to es2020 eh?
a year ago
awsome, see, just a tiny misconfiguration
a year ago
no problem, happy you where able to solve this
a year ago
feel free to remove me from th github repo 🙂
im your latest supporter 😄 https://www.buymeacoffee.com/brody192/c/8685971
a year ago
i was trying to figure out who that was lol
thank you for the train!
Actually this already happen yesterday. I didn't notice the failed build. This is the build log yerterday. it shows network error.
a year ago
first build log is for an issue with date-fns, second build log is an issue with cache, what is the current issue you get?
a year ago
that does not clear the cache on railway
a year ago
that runs a local command
a year ago
so the latest build is failing because it can't find date-fns?
is there a way to know what node version or how railway build? what i know only is that its using nixpacks
a year ago
node 18, printed at the top of the build logs
a year ago
have you modified your package.json? this is a different error from before, this time it just looks like it's outright not being installed
a year ago
add me back to the repo?
a year ago
what branch is currently set to deploy to railway?
a year ago
I've probably asked you this before, but you do use yarn locally right?
a year ago
what version?
a year ago
okay close enough to what railway uses
a year ago
can you delete the lock file, and then regenerate it, let me know if git says it has changed
a year ago
so how opposed would you be to switching to just npm as a test? (I'm running out of ideas)
a year ago
aka delete your yarn lock file and generate an npm lock file with npm install
a year ago
and to answer this question, yes they do, not intentionally, they rebase the image to get some os level security updates and sometimes they change the version of nix being used and that also can cause issues. but railway has not changed the builder since we last talked.
a year ago
is the install command listed as npm ci
?
hmm think might be cache. after this I will back to yarn and try this NO_CACHE option
https://docs.railway.app/guides/build-configuration
a year ago
in the build table at the top of the build logs
a year ago
yeah this might be a cache issue
I guess caching needs to be fixed by railway. for now, I will add no cache whenever I experienced this issue
this is not good tho. we choose railway so can just focus directly on development with 0 configs on server
a year ago
while this particular experience is not good, from personal experience, unfortunately there is no such thing as zero configuration deployments, on any platform
a year ago
I agree
a year ago
that's fair
a year ago
happy to help!
ohh just fyi. i removed no cache and it fails again. seems I can't use cache for now hehe
a year ago
the cache on the host machine is likely in a bad state, best to keep the no cache variable