yamak

@Luka ... make sure you install popper.js. Bootstrap needs it.

npm i popper.js

consil
consil
2 weeks ago (15,320 XP)

@Luka Did you every get an answer to your questions? One thing I am certain of, is that the node_modules directory does not get installed on your live web server. It's a massive directory full of development stuff. The assets installed on the final server is what is in the public directory.

I'm looking for the same answers - how do I get from installing Laravel 5.6 to using bootstrap 4 classes in my views. There seems to be a lot of magic in the middle, and no one place where it is explained, because it involves so many moving parts from so many sources, with so many assumptions about what is installed where, and at what version, and with so much that can go wrong.

skoobi
skoobi
2 weeks ago (23,130 XP)

Just read back through the feed. Some solutions (I hope):

The .map error, you can add the source map in your webpack.mix.js file:

mix.js('resources/assets/js/app.js', 'public/js')
   .sourceMaps();

On the node_modules, if i'm correct its on the local host but when you compile it down it stores the necessary scripts etc into the app.js/app.css.

What you need to do to use those modules is import it into your assets/js/app.js or the assets/scss/app.scss file after you have installed the module through npm.

So for example I used Buefy for a project and here's my app.js code and what i used to import Buefy into the project::


require('./bootstrap');
window.Vue = require('vue');

// For Alerts
import Buefy from 'buefy'
Vue.use(Buefy)

Vue.component('laratoaster', require('./components/LaraToaster.vue'));

const app = new Vue({
    el: '#app'
});

Also for popper.js make sure its installed via npm and then make sure this is in your assets/js/bootstrap.js file :

window.Popper = require('popper.js').default;

Hope this helps...

Luka
Luka
2 weeks ago (3,070 XP)

@consil, no, I didn't. My project is not complete yet, but I copied the node_modules to the webserver. I was not happy with it, but was just not sure how to work it out otherwise. I am just reading the reply from skoobi, so I will get back to it and see if I can make it work on the server without the node_modules. But yes you are absolutely right, so much involved and rather complicated to understand and in the end, I am just happy when I get it somehow to work.

@skoobi Thank you for your reply. I will try to get back into it and see if I get it to work as you said.

Please sign in or create an account to participate in this conversation.