VideoJS not working

For some strange reason I can’t seem to get videojs working in ionic 2. I went ahead and imported the package through npm and then installed the types for it. When i go to create a new player via the videojs function I get an error stating.

Cannot find module "videojs"
Stack
Error: Cannot find module "videojs"
at Object.<anonymous> (http://localhost:8100/build/main.js:62308:7)
at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8100/build/main.js:62446:97)
at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8100/build/main.js:62551:83)
at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8100/build/main.js:43987:69)
at __webpack_require__ (http://localhost:8100/build/main.js:20:30)
at Object.<anonymous> (http://localhost:8100/build/main.js:132948:81)
at __webpack_require__ (http://localhost:8100/build/main.js:20:30)

I have looked over the typescript file several times and it looks like i’m doing everything properly.

let video = videojs("video");

Thanks in advance!

I believe the problem may be that I don’t have the dependencies installed that videojs relies on. Do I have to do this manually? I thought that the dependencies of my dependencies were automatically included?

Edit:

It looks like for whatever reason the package was not installed correctly. I found this out by navigating to the package under node_modules and checking to see if it had a node_modules folder too. If it did I found that it was not working properly.

To fix the problem I uninstalled the package and made sure that none of it’s dependencies were in my package.json and then reinstalled using npm install --save and it worked. I also double checked that the libraries own dependencies were under the ionic apps root node_modules as well (they were).

A quick, note make sure ionic serve is not running during any of the uninstall / install operations just to be safe. Also ensure you uninstall using npm uninstall --save to ensure the dependency is removed from the package.json.

Hopefully this helps someone.