2

Apologies if this seems like I'm missing something very obvious. (I'm using an app built with npm and backbone) I am trying to load my datetimepicker module using common.js

datetimepicker = require('eonasdan-bootstrap-datetimepicker')

When I go to add a datetimepicker in my app, I get:

Uncaught TypeError: $(...).datetimepicker is not a function

When I look in my debugger I can see the module is not getting loaded. It has been installed in my node modules folder. I'm just wondering can anyone spot anything obvious I could be missing. I have imported moment and jquery as they are listed dependencies. They are imported/loaded before the datetimepicker. Any help greatly appreciated.

Eonasdan
  • 7,563
  • 8
  • 55
  • 82
  • Not familiar with commonjs, but have you defined `'eonasdan-bootstrap-datetimepicker` as the path to actual .js file somewhere..? – T J Jan 13 '16 at 10:03
  • yes, as far as I know. npm will automatically check the node_modules folder for eonasdan-bootstrap-datetimepicker module once I have added datetimepicker = require('eonasdan-bootstrap-datetimepicker') it will check a module called eonasdan-bootstrap-datetimepicker exists and if so it will then check for a package.json file for the module. Where there should be some reference on how to access the js file. Thanks for the reply TJ – tonyMcMister Jan 13 '16 at 10:11
  • @tonyMcMister how did you solve did? I have [similar problem](http://stackoverflow.com/questions/35604288/datetimepicker-is-not-a-function) – Matt Feb 25 '16 at 08:50

1 Answers1

0

Try

window.datetimepicker = require('eonasdan-bootstrap-datetimepicker');

Also be sure that you load moment.js which required for this library