DEV Community

Cover image for NPM vs. Composer/Laravel 8.x, and Heroku

Posted on

NPM vs. Composer/Laravel 8.x, and Heroku

Hi, I hope this will help some people! My newest project has been giving me some headaches - but hey! Who doesn't love a challenge?
Challenges are great but when you end up getting tripped up in the details, a challenge can become a nuisance in a hurry.
For context, I am using Laravel 8.x, PostgreSQL, and PHP 7.3. I am deploying my application to Heroku and all is great until you run into some pesky issues with the composer.json file. Historically, I have used NPM as my default package manager and haven't run into any troubles... until now. I utilized the Laravel/UI along with the vue auth model. I used NPM as my package manager and all went well until I went to deploy the application on Heroku. I received the following error:

In order to use the Auth::routes() method, please install the laravel/ui package.

I was puzzled by this and did some digging. I didn't find any "specific" info dealing with this issue - but after some trial and error (i.e. making sure that the bootstrap/cache/gitignore file was included in my repo - which did NOT work), I backed out of my latest push to Git and did the following:

  1. composer require laravel/ui
  2. composer install
  3. composer dump-autoload
  4. php artisan config:cache (eliminates cached values)
  5. commit and push to git
  6. deploy to heroku

This worked! Hallelujah! So with the combination of tech that I am using for this project - it looks like that you must use composer vs npm for the laravel/ui dependencies to work properly.

Hope this helps some people!!!

Top comments (0)