无法在Laravel中的app.scss中导入“bootstrap-select”

I'm doing following:

npm install bootstrap-select

npm run dev

in app.scss

// Bootstrap Select

@import "node_modules/bootstrap-select/sass/bootstrap-select.scss";

In console it says:

jQuery.Deferred exception: $(...).selectpicker is not a function
TypeError: $(...).selectpicker is not a function

I can see it installed bootstrap-select, how do I import it correctly?

In your /resources/assets/sass/app.scss import bootstrap-select:

@import "../../../node_modules/bootstrap-select/sass/bootstrap-select.scss";

You also need to import bootstrap-select.js to resources/assets/js/app.js make it work:

require('../../../node_modules/bootstrap-select/dist/js/bootstrap-select');

npm install bootstrap-select

npm run dev


In resources\assets\sass\app.scss

@import "node_modules/bootstrap-select/sass/bootstrap-select.scss";


in resources\assets\js\app.js

require('../../../node_modules/bootstrap-select/dist/js/bootstrap-select.js');


Add app.scss in head

Add app.js before end of body

in laravel 5.7

in app.scss

@import '~bootstrap-select/sass/bootstrap-select.scss';

in app.js

require('../../node_modules/bootstrap-select/dist/js/bootstrap-select.min');