Deploy crashing
theoriginalhats
FREEOP

a year ago

everytime i try to redeploy my project it ends up crashing a couple seconds later

Solved

71 Replies

theoriginalhats
FREEOP

a year ago

f99bc61f-2053-4bd0-b638-c0ea4289d6de


a year ago

This is most likely a problem with your code or you are exceeding your plan's limits


a year ago

Mind sharing your deploy logs?


theoriginalhats
FREEOP

a year ago

this is the error i get:
```
Starting Container

npm warn config production Use --omit=dev instead.

npm error Missing script: "tailwind.config.js"

npm error

npm error To see a list of scripts, run:

npm error npm run

npm error A complete log of this run can be found in: /root/.npm/logs/2025-02-11T222230993Z-debug-0.log

npm warn config production Use --omit=dev instead.

npm error Missing script: "tailwind.config.js"

npm error

npm error To see a list of scripts, run:

npm error npm run

npm error A complete log of this run can be found in: /root/.npm/logs/2025-02-11T222233908Z-debug-0.log```


theoriginalhats
FREEOP

a year ago

i still have $4+ left


a year ago

Did you commit the tailwind config file?


theoriginalhats
FREEOP

a year ago

i did yes


a year ago

are you sure you are not using Tailwind V4?


theoriginalhats
FREEOP

a year ago

3.4.1


a year ago

I honestly have no idea then


theoriginalhats
FREEOP

a year ago

thanks for trying to help


a year ago

you have your start command set to npm run tailwind.config.js


a year ago

what kind of app is this


theoriginalhats
FREEOP

a year ago

i made some slight updates but now i cant uplaod my "node_modules" folder to github


theoriginalhats
FREEOP

a year ago

it says too many files


a year ago

you wouldnt want to be uploading that folder to begin with


theoriginalhats
FREEOP

a year ago

then what should i do?


a year ago

^


theoriginalhats
FREEOP

a year ago

what do you mean what kind of app?


a year ago

my apologies, im going to have to step out here and let the community involve themselves


theoriginalhats
FREEOP

a year ago

alright no problem


a year ago

  1. You should have a .gitignore file that has the node_modules directory listed.

  2. Delete the nodemodules directory and commit the removal of this directory with the addition of the said .gitignore file, this way you won't accidentally commit your nodemodules again.

  3. After you have committed those changes, you will have to run npm install to download all dependencies again.

  4. How do you build/start your app? It definitely isn't npm run tailwind.config.js since that's a config file. Also, what kind of app is it, is it an API server, an entire full stack application, etc.?



theoriginalhats
FREEOP

a year ago

its a website


a year ago

How do you run it locally?


theoriginalhats
FREEOP

a year ago

running it from github


a year ago

<:oop:1231933790671208499>


a year ago

No, like what do you run in your terminal to run it. For example: node app.js


theoriginalhats
FREEOP

a year ago

npm run build


a year ago

That's your build command


a year ago

Anyway, remove your custom start command and redeploy it with the changes I have sent above


theoriginalhats
FREEOP

a year ago

where do i run npm install


a year ago

Locally


a year ago

That is, if you want to run your application on your local machine first, to ensure that it is actually working.


theoriginalhats
FREEOP

a year ago

alright i figured out i had to run npm install and then do npm run dev


theoriginalhats
FREEOP

a year ago

on my local machine


a year ago

great


a year ago

can I assume that your repo is now cleaned up and ready for being deployed on railway?


theoriginalhats
FREEOP

a year ago

but now on railway my build command is set to npm install and start command to npm run dev, its not crashing but im getting bad gateway error


a year ago

you shouldn't run npm run dev, since that's the development server


theoriginalhats
FREEOP

a year ago

so what should i run?


a year ago

npm run start


a year ago

However, can I see your package.json?


a year ago

Just the script part such as:

"scripts": {
  "dev": "next dev",
  "build": "next build",
  "start": "next start",
  "lint": "next lint"
},

theoriginalhats
FREEOP

a year ago

json "scripts": { "start": "node server.js", "dev": "vite", "build": "vite build", "lint": "eslint .", "preview": "vite preview" },


theoriginalhats
FREEOP

a year ago

got this error now

```err
node:internal/modules/cjs/loader:1143

throw err;

^

Error: Cannot find module '/app/server.js'

at Module._resolveFilename (node:internal/modules/cjs/loader:1140:15)

at Module._load (node:internal/modules/cjs/loader:981:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12)

at node:internal/main/run_main_module:28:49 {

code: 'MODULENOTFOUND',

requireStack: []

}

Node.js v18.20.5```


a year ago

Do you actually have server.js committed? Can I see your repository?


theoriginalhats
FREEOP

a year ago

i changed it to:

json "scripts": { "start": "vite", "dev": "vite", "build": "vite build", "lint": "eslint .", "preview": "vite preview" },


theoriginalhats
FREEOP

a year ago

but its on localhost and not my domain


a year ago

does it work locally?


theoriginalhats
FREEOP

a year ago

yep


a year ago

also the production build? as in npm run build && npm run start


theoriginalhats
FREEOP

a year ago

npm run build gives a error


theoriginalhats
FREEOP

a year ago

so i have npm install instead


a year ago

I meant locally, can you run it with npm run build && npm run start?


theoriginalhats
FREEOP

a year ago

yep


theoriginalhats
FREEOP

a year ago

1339367790989017000


a year ago

great, try deploying it to railway now


theoriginalhats
FREEOP

a year ago

error
```
vite v5.4.14 building for production…

transforming…

✓ 2 modules transformed.

x Build failed in 53ms

error during build:
[vite]: Rollup failed to resolve import "/src/main.tsx" from "/app/index.html".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
build.rollupOptions.external
at viteWarn (file:///app/nodemodules/vite/dist/node/chunks/dep-CHZK6zbr.js:65747:17) at onwarn (file:///app/nodemodules/@vitejs/plugin-react/dist/index.mjs:273:9)
at onRollupWarning (file:///app/nodemodules/vite/dist/node/chunks/dep-CHZK6zbr.js:65777:5) at onwarn (file:///app/nodemodules/vite/dist/node/chunks/dep-CHZK6zbr.js:65442:7)
at file:///app/nodemodules/rollup/dist/es/shared/node-entry.js:19393:13 at Object.logger as onLog at ModuleLoader.handleInvalidResolvedId (file:///app/nodemodules/rollup/dist/es/shared/node-entry.js:20008:26)
at file:///app/node_modules/rollup/dist/es/shared/node-entry.js:19966:26

✕ [stage-0 8/10] RUN --mount=type=cache,id=s/5dad21a0-5134-4502-a4c8-c9fb5b424260-nodemodules/cache,target=/app/nodemodules/.cache npm run build
process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1

Dockerfile:24

22 | # build phase

23 | COPY . /app/.

24 | >>> RUN --mount=type=cache,id=s/5dad21a0-5134-4502-a4c8-c9fb5b424260-nodemodules/cache,target=/app/nodemodules/.cache npm run build

25 |

26 |

ERROR: failed to solve: process "/bin/bash -ol pipefail -c npm run build" did not complete successfully: exit code: 1

Error: Docker build failed```


a year ago

Can I see your repo?


theoriginalhats
FREEOP

a year ago


a year ago

As the build logs suggest, you are referencing something that doesn't exists, there is no src directory in the repository above.


a year ago

I have attached a screenshot of your repository and a snippet of your index.html.

1339661993539539000
1339661993828941800


theoriginalhats
FREEOP

a year ago

completely forgot abt this


theoriginalhats
FREEOP

a year ago

but i fixed that


theoriginalhats
FREEOP

a year ago

and now npm run build works


theoriginalhats
FREEOP

a year ago

i get this

1340721492169589000


a year ago

You changed the start command to just vite again, which starts the dev server.


theoriginalhats
FREEOP

a year ago

o so what should i change it to?


a year ago

You need a web server to serve your static asset(s). Previously, you were using or at least attempted to use express as such. You can also use caddy, please refer to this template in this case https://railway.com/template/NeiLty


a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...