Why do I need to npm run dev in my local vscode

ednaodettaTRIAL

2 months ago

PLEASE HELP, URGENT. When i npm run dev in my vscode, the app i deployed in railway works fine. But when i dont open vscode & dont npm run dev, it (the railway link) looks chaotic. It seems like the tailwind CSS doesn't work in the railway deployed version. Aren't railway and my local not supposed to be connected? What should I do to make users open the link and the website look fine. Please look at my project and tell me if i did anything wrong with the deployment process.

Closed

14 Replies

unicodeveloperPRO

2 months ago

npm run dev is for development. What's the build script in your package.json file? The one that runs for it to build your app for production.


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

it's vite build, this is my package.json. How can i change it to make it like my normal website when deploying in railway?

{

    "private": true,

    "type": "module",

    "scripts": {

        "build": "vite build",

        "dev": "vite"

    },

    "devDependencies": {

        "autoprefixer": "^10.4.20",

        "axios": "^1.7.4",

        "concurrently": "^9.0.1",

        "laravel-vite-plugin": "^1.0",

        "postcss": "^8.5.2",

        "tailwindcss": "^3.4.17",

        "vite": "^5.0"

    },

    "dependencies": {

        "alpinejs": "^3.14.8"

    }

}


Status changed to Awaiting Railway Response railway[bot] 2 months ago


unicodeveloperPRO

2 months ago

Please add the command "npm run build" as a predeploy command in your service settings. This way it can build it before deploying.

Attachments


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

Okay I've added npm run build as a Pre-deploy Command, but it still doesn't work. Sorry, would you mind checking again?

This is how it's supposed to look like

But instead it looks like this using the railway link

Attachments


Status changed to Awaiting Railway Response railway[bot] 2 months ago


unicodeveloperPRO

2 months ago


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

yes I did. Can you check what's wrong?


Status changed to Awaiting Railway Response railway[bot] 2 months ago


unicodeveloperPRO

2 months ago

I see this is a Laravel app. I can't see `@tailwindcss/vite` as a dependency even though you said you followed that instruction.

Also please move the dependencies from "devDependencies" to "dependencies".


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

I've made those changes and it still doesn't work. Sorry, but can you please check what's still missing?


Status changed to Awaiting Railway Response railway[bot] 2 months ago


unicodeveloperPRO

2 months ago

I am trying to help you through it. This is not a deployment issue. It's a config missing in your setup which is frankly a code/app issue, not Railway.

Another thing you should try is to make this change: https://www.lamadly.com/articles/css-not-working-when-deploying-in-railway-app


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

I really really really appreciate your help. I've added the HTTPS change and it still doesn't work. I'm super stressed out. Sorry, I'm a beginner and this is my first time using both laravel and railway. Please help and tell me what to do next T-T or perhaps you can clone my git repository and tell me whats wrong? please..


Status changed to Awaiting Railway Response railway[bot] 2 months ago


unicodeveloperPRO

2 months ago

If you go to your console/network tab, you can see the issue. Your vite scripts are still being injected wrongly. I can't clone your repo and do it. That's beyond the scope of what I can help with.

However, you can try two things:

  1. Deploy the Laravel app from our guide. I personally wrote this guide https://docs.railway.com/guides/laravel

  2. Deploy this Laravel template https://railway.com/template/Gkzn4k. You can eject from this template into your repo and also compare it with what you might be doing wrong. This is the repo https://github.com/unicodeveloper/complete-laravel-on-railway


Status changed to Awaiting User Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

I'm sorry i don't understand. I followed your guide on building the database and all. I really did. There must be a way for me to not start over right? How is the vite scripts inject wrong? can i not fix it from the code? I don't need you to do it, I just want your help to clone my repo and find the mistake. I really tried everything from google, stack overflow, and all. But nothing seems to be working. Please tell me what to fix..


Status changed to Awaiting Railway Response railway[bot] 2 months ago


ednaodettaTRIAL

2 months ago

please help


2 months ago

Hello,

I'm really sorry but we cannot provide a level of support greater than what prosper has tried to do for you.

Anything above the level of support he offered would be out of the scope of what these forums are intended for, as your issue is not related to the Railway platform or product, but as prosper pointed out, a misconfiguration on your side.

Again, I'm sorry but we will not be able to provide further assistance here, please read over everything propser has already given you.

Best,
Brody


Status changed to Awaiting User Response railway[bot] 2 months ago


Status changed to Closed brody 2 months ago


Why do I need to npm run dev in my local vscode - Railway Help Station