suzumejakku
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
Fantastic, it works ! Thanks a ton 🙂 The strangest thing happened though: I executed the command "railway up" and on the railway UI I could see that two deployments started at the same time (one was just 5 seconds behind). No idea why. But anyway, one of the deployment failed, and the other one worked. Just to be sure, I deployed again with "railway up", and this time only 1 deployment started, and it worked perfectly. Thanks again for your help.
23 replies
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
No, sorry it is not open source. In parallel I am trying to reach out to Railway support directly for this issue. What I can tell additionally is that my app runs on Rails 7 with a Vue front end. Not sure it helps with anything. Sorry Finn, not sure what else to share or do… but anyway, thanks for the time spent trying to help me out, really appreciate it. I will update this thread if I somehow fix my problem.
23 replies
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
I don’t understand what you mean by “ckmmand5”, sorry. I can run “yarn run prepare”, but I don’t know what kind of command I should put after “ && “. I understand you tell me to put a <build command>, but I do not know what command this is, as usually, if I didn’t have a “prepare” script, I wouldn’t have to put any <build command> at all (Heroku / Railway does something automatically but I do not know what it is they run).
23 replies
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
Sorry, I guess I was not clear. First, "yarn run prepare" is, I guess, equivalent to "npm run prepare" (I use yarn and not npm). What I am trying to say is that if I remove the "prepare" script, Railway is able to deploy automatically without any issue. When I add a "prepare" script, Railway does not run it by default before starting to compile the javascript files - which is problematic, as I need to have this script run first. So to run "prepare" script first, I did what you suggested: edit the Railway settings under "build settings" and put "yarn run prepare" ... and it worked, it ran the "prepare" script, but nothing else. So now I have to run another script, I assume, to compile my javascript files and use the command "yarn run prepare && build" - but I do not have a "build" script. When I deploy with Heroku, I don't need such script, Heroku knows what to do. And when I deploy under Railway (without the "prepare" script), Railway also knows what to do, it does not need a "build" script. Sorry, long explanation...
23 replies
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
That was quick! So my problem is, I do not have a "normal build command". I just let Heroku (and now Railway) do their stuff. I have a simple package.json with only 1 "prepare" script which Heroku seems to run before any build command of its own, and which Railway doesn't. So after "yarn run prepare", I have nothing else to run. If I delete the "prepare" script, remove any reference to "LIB_VERSION" in my code, and do not edit the "build command" in the settings of Railway, Railway is able to deploy my app without any issue. I do not know what kind of script or call it does by default, hence I do not know what to put after "yarn run prepare && xxxxx" 😕
23 replies
[RESOLVED] package.json's script, how to run 'prepare' and then build ?
@Finn many thanks for your response! I had given up hope so I did not check back in discord for quite a while, hence my late reply 🙂 . Now, it did help but it doesn't work quite yet. Problem is, I am a complete noob when it comes to npm / yarn / package.json. So as shown in my excerpt above, I have only 1 script, "prepare". So if I edit the build settings of my railway.app to "yarn run prepare", it does indeed run the "prepare" script... but it stops there, it does not compile my whole vue app. How can I run "prepare" and then continue with the normal flow, i.e. compile the rest of my javascript ?
23 replies