4

I have deployed a Laravel project on Heroku that uses Vue components, but the content of these components doesn't appear on the app's webpages. Only contents of .blade.php files are being rendered.

So, how do I deploy a Laravel and Vue project properly with Heroku?

My app's Procfile:

web: vendor/bin/heroku-php-apache2 public/

I tried adding some extra commands to the dyno such as web: npm run watch & vendor/bin/heroku-php-apache2 public/ and web: npm install vendor/bin/heroku-php-apache2 public/ but I had no luck.

And no, my app runs perfectly fine localy with npm run watch and php artisan serve commands, there's nothing wrong with it.

1 Answer 1

8

First, it is needed to enable node.js:

heroku buildpacks:add heroku/nodejs

Set:

heroku config:set NPM_CONFIG_PRODUCTION=false

Then add postinstall in package.json scripts:

  "scripts": {
    "postinstall": "npm run prod"
  }

You can also clear cache on laravel application deployed to heroku.

After you do theses steps, it will be possible to run node commands.

Here is reference what I used: https://www.neontsunami.com/posts/using-laravel-and-laravel-elixir-on-heroku

Sign up to request clarification or add additional context in comments.

1 Comment

could you please help me i've been stucked with similar issue stackoverflow.com/questions/59084954/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.