Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Shivamyadav's avatar

deploying laravel project ? npm run dev error may be

I'm having a vite link to include it in my layout

  @vite(['resources/css/app.css', 'resources/js/app.js'])

and always it needs to run the cmd to compile it in the css and js to include it command npm run dev and it works fine in devlopment. The issue persist in the deployment when i am trying to run the npm run dev in deployment and run it, it just running infinite and doesn't stop , due to this issue the project is not being deployed.

2nd condition .. when I am trying it to deploy without npm run dev cmd it works and deployed but the alpine part and some other stuffs seems not working.🥺 Thanks for any help..

you can check here the error without npm run dev https://blog-production-0fc7.up.railway.app/login

0 likes
11 replies
piljac1's avatar

On a production environment you should run npm run build to actually compile and minify your assets.

1 like
Shivamyadav's avatar

@Snapey I thik yeah, If i didn't install the npm then the same issue also persist there..

DhPandya's avatar

@Shivamyadav On the production/server running npm run dev will not work. For that you have to generate the production builds using the npm run build command. This looks like there is something wrong with your SSL. See console error: Mixed Content: The page at 'https://blog-production-0fc7.up.railway.app/login' was loaded over HTTPS, but requested an insecure script.

martinbean's avatar

@Shivamyadav Your assets are built. But you’re trying to request them using HTTPS URLs but the app thinks it’s running under HTTP, which means you’ve not configured your app to trust Railway’s proxy/load balancer.

Follow the instructions here to trust Railway’s proxy/load balancer, and your app should correctly detect it is running as HTTPS.

himelmaj's avatar

Has anyone been able to solve it? I'm having the same problem

MohamedTammam's avatar

In your .env file set the APP_URL to https://blog-production-0fc7.up.railway.app

Then run npm ci and npm run build

Please or to participate in this conversation.