Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

randm's avatar
Level 6

How can I include bootstrap-datetimepicker in my Mix setup?

I need to include bootstrap-datetimepicker into my Mix setup. https://github.com/Eonasdan/bootstrap-datetimepicker

The bootstrap-datetimepicker package does not offer Node.js installer. How can I include it in my project?

Here is what I tried, I added a folder resources/assets/vendors and manually download the https://github.com/Eonasdan/bootstrap-datetimepicker in to it.

Then in my resources/assets/app.sass the following line

@import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap";

But i am getting the following error when compiling the assets using npm run watch

Module build failed: ModuleNotFoundError: Module not found: Error: Can't resolve
 './resources/assets/vendors/bootstrap-datetimepicker-4.17.47/build/css/bootstra
p-datetimepicker.css' in 'resources\assets\sass' at factoryCallback (node_modules\webpack\lib\Compilation.js:260:39)

I am also unsure on how to require the package in my project... but I tried adding the following line in `resources/assets/js/app.js``. Is this the right way to include it?

require('../vendors/bootstrap-datetimepicker-4.17.47/build/js/bootstrap-datetimepicker.min.js');
0 likes
6 replies
peterl38's avatar

In the past I've added:

"eonasdan-bootstrap-datetimepicker": "^4.17.47",

to my package.json and it seems to work in Laravel 5.2 I must admit I've not added ti to a 5.4 project yet.

randm's avatar
Level 6

Thanks for the tip about the available download for node.js.

But, does that means I can't include a package that does not have node.js installer?

Also, how can I include the package's css file into my own app.sass class? how do I include it?

1 like
irvv17's avatar

@MALHAYEK - Hey man You need to import the css file like this

// bootstrap-datepicker @import "node_modules/bootstrap-datepicker/dist/css/bootstrap-datepicker";

cause the plugin doesn't has a .sass file but mix can compile the .css either way.

idhamhafidz's avatar

I just change to bower for installation. Dont know why, NPM package for bootstrap-datetimepicker is not working.

Rizkhal's avatar

You can use npm install pc-bootstrap4-datetimepicker --save and update your resources/js/bootstrap.js like this window.datetimepicker = require('pc-bootstrap4-datetimepicker');

now you can access datetimepicker globaly

dont forget to run npm run dev again

Please or to participate in this conversation.