Search code examples
laravelvue.jscomponentslaravel-5.4

How do I make Example.vue update in Laravel?


I just read the answers to this question and wasn't able to get a good response.

Laravel Example.vue not updating

I also posted this question trying to figure it out on my own but to no avail.

how do I load a Vue component in Laravel 5.4?

As another attempt, I just did a new reinstall of Laravel, and while I am able to get the default Example.vue component to load multiple times in a single view, I am still unable to change the contents of the component. Funnier thing is that when I run npm install and then npm run dev, the component ceases to even show up anymore.

This is really frustrating because Laravel ships with Vue.js yet I am unable to utilize it. Any help would be much appreciated! :)


Solution

  • You need to install the node dependencies and then compile them.

    1. Install node.js
    2. From your projects root run npm install
    3. From your projects root run npm run dev

    Your browser may also be showing the cached version. Chrome has a setting that you can have the cache disabled while the inspector is open.

    You can also check it by opening your project in other browsers.

    If when running npm run dev dies without any message of any kind you can delete your node_modules folder then run npm install and then compile your assets again.

    You may also need to clear and rebuild a few other caches with commands:

    composer dump-autoload
    php artisan clear-compiled
    php artisan cache:clear