Deploy crashing
theoriginalhats
FREEOP

2 years ago

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

Solved

71 Replies

theoriginalhats
FREEOP

2 years ago

f99bc61f-2053-4bd0-b638-c0ea4289d6de


2 years ago

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


2 years ago

Mind sharing your deploy logs?


theoriginalhats
FREEOP

2 years 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-11T22_22_30_993Z-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-11T22_22_33_908Z-debug-0.log```


theoriginalhats
FREEOP

2 years ago

i still have $4+ left


2 years ago

Did you commit the tailwind config file?


theoriginalhats
FREEOP

2 years ago

i did yes


2 years ago

are you sure you are not using Tailwind V4?


theoriginalhats
FREEOP

2 years ago

3.4.1


2 years ago

I honestly have no idea then


theoriginalhats
FREEOP

2 years ago

thanks for trying to help


2 years ago

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


2 years ago

what kind of app is this


theoriginalhats
FREEOP

2 years ago

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


theoriginalhats
FREEOP

2 years ago

it says too many files


2 years ago

you wouldnt want to be uploading that folder to begin with


theoriginalhats
FREEOP

2 years ago

then what should i do?


2 years ago

^


theoriginalhats
FREEOP

2 years ago

what do you mean what kind of app?


2 years ago

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


theoriginalhats
FREEOP

2 years ago

alright no problem


2 years ago

  1. You should have a .gitignore file that has the node_modules directory listed.
  2. Delete the node_modules directory and commit the removal of this directory with the addition of the said .gitignore file, this way you won't accidentally commit your node_modules 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

2 years ago

its a website


2 years ago

How do you run it locally?


theoriginalhats
FREEOP

2 years ago

running it from github


2 years ago

<:oop:1231933790671208499>


2 years ago

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


theoriginalhats
FREEOP

2 years ago

npm run build


2 years ago

That's your build command


2 years ago

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


theoriginalhats
FREEOP

2 years ago

where do i run npm install


2 years ago

Locally


2 years ago

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


theoriginalhats
FREEOP

2 years ago

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


theoriginalhats
FREEOP

2 years ago

on my local machine


2 years ago

great


2 years ago

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


theoriginalhats
FREEOP

2 years 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


2 years ago

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


theoriginalhats
FREEOP

2 years ago

so what should i run?


2 years ago

npm run start


2 years ago

However, can I see your package.json?


2 years ago

Just the script part such as:

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

theoriginalhats
FREEOP

2 years ago

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


theoriginalhats
FREEOP

2 years ago

got this error now

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: 'MODULE_NOT_FOUND',

  requireStack: []

}

 

Node.js v18.20.5```


2 years ago

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


theoriginalhats
FREEOP

2 years ago

i changed it to:

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


theoriginalhats
FREEOP

2 years ago

but its on localhost and not my domain


2 years ago

does it work locally?


theoriginalhats
FREEOP

2 years ago

yep


2 years ago

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


theoriginalhats
FREEOP

2 years ago

npm run build gives a error


theoriginalhats
FREEOP

2 years ago

so i have npm install instead


2 years ago

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


theoriginalhats
FREEOP

2 years ago

yep


theoriginalhats
FREEOP

2 years ago

1339367790989017170


2 years ago

great, try deploying it to railway now


theoriginalhats
FREEOP

2 years 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/node_modules/vite/dist/node/chunks/dep-CHZK6zbr.js:65747:17)
    at onwarn (file:///app/node_modules/@vitejs/plugin-react/dist/index.mjs:273:9)
    at onRollupWarning (file:///app/node_modules/vite/dist/node/chunks/dep-CHZK6zbr.js:65777:5)
    at onwarn (file:///app/node_modules/vite/dist/node/chunks/dep-CHZK6zbr.js:65442:7)
    at file:///app/node_modules/rollup/dist/es/shared/node-entry.js:19393:13
    at Object.logger [as onLog] (file:///app/node_modules/rollup/dist/es/shared/node-entry.js:21119:9)
    at ModuleLoader.handleInvalidResolvedId (file:///app/node_modules/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-node_modules/cache,target=/app/node_modules/.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-node_modules/cache,target=/app/node_modules/.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```


2 years ago

Can I see your repo?


theoriginalhats
FREEOP

2 years ago


2 years ago

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


2 years ago

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

1339661993539539054

1339661993828941915


theoriginalhats
FREEOP

2 years ago

completely forgot abt this


theoriginalhats
FREEOP

2 years ago

but i fixed that


theoriginalhats
FREEOP

2 years ago

and now npm run build works


theoriginalhats
FREEOP

2 years ago

i get this

1340721492169588928


2 years ago

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


theoriginalhats
FREEOP

2 years ago

o so what should i change it to?


2 years 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


2 years ago

!s


Status changed to Solved brody over 1 year ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...