How to add an npm package and use it on Cordova client

Hi, I am trying to add the datepicker plugin to my Cordova app, but the one on the Cordova plugin registry is just a really old version that doesn’t quite work for me right now (iOS 7+), and I found out that on NPM there is a newer version, I tried adding it with meteorhacks:npm but it only works for the server and when using cosmos:browserify I always get an error

(Cannot find module 'cordova-plugin-datepicker' from '/Users/jeronimocosio/vynomvp/vynomvp/packages/npm-container/.npm/package')  

So I wanted to know if there is another way to add this plugin so that I can use it on Cordova. :wink:
This is the link to the plugin: https://www.npmjs.com/package/cordova-plugin-datepicker

Downloading plugins from npm is supported in Cordova 5.0 or higher, which will be included in Meteor 1.2. You can use the RC to try this out (meteor update --release 1.2-rc.12) and install the plugin using meteor add cordova:cordova-plugin-datepicker@0.8.6.

1 Like

Amazing! I’m going to out the new RC to see how I do. :wink:

Edit: Worked like a charm!

After updating to RC 1.2, I can’t no longer run my app I get 85 errors on the log console with this errors:

Any idea how to fix this? Can I downgrade?

It seems the GroundDB error is similar to this issue, and should be fixed by upgrading GroundDB to the latest version. That might also solve your other problems.

I allready tried that that at it didn’t worked, so I had to uninstall the package and use Mongo collection as normal without ‘grounding’ them and everything seems to work fine on web, however on mobile when I try to run it with Xcode, I get this on the console but the app gets stuck on the splash screen with the loading thing in the middle:

Console:

2015-09-05 14:36:11.509 VYNO[6680:75536] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/jeronimocosio/Library/Developer/CoreSimulator/Devices/4C571412-A637-4E82-AFA1-2F44B2172645/data/Containers/Data/Application/6F9DBD44-1806-49BA-97DE-F80E0CE9B2CF/Library/Cookies/Cookies.binarycookies
2015-09-05 14:36:11.590 VYNO[6680:75536] Apache Cordova native platform version 3.9.1 is starting.
2015-09-05 14:36:11.590 VYNO[6680:75536] Multi-tasking -> Device: YES, App: YES
2015-09-05 14:36:11.593 VYNO[6680:75536] Unlimited access to network resources
2015-09-05 14:36:11.596 VYNO[6680:75536] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file

2015-09-05 14:36:11.697 VYNO[6680:75536] [CDVTimer][keyboard] 0.061989ms
2015-09-05 14:36:11.734 VYNO[6680:75536] [CDVTimer][splashscreen] 37.550032ms
2015-09-05 14:36:11.746 VYNO[6680:75536] [CDVTimer][file] 11.034966ms
2015-09-05 14:36:11.751 VYNO[6680:75536] [CDVTimer][statusbar] 5.086958ms
2015-09-05 14:36:11.799 VYNO[6680:75536] [CDVTimer][socialsharing] 47.944963ms
2015-09-05 14:36:11.799 VYNO[6680:75536] [CDVTimer][TotalPluginStartup] 102.791965ms
2015-09-05 14:36:11.905 VYNO[6680:75536] active
2015-09-05 14:36:11.907 VYNO[6680:75536] Attempting to badge the application icon but haven't received permission from the user to badge the application
2015-09-05 14:36:12.225 VYNO[6680:75536] Resetting plugins due to page load.
2015-09-05 14:36:12.286 VYNO[6680:75536] Finished load of: file:///Users/jeronimocosio/Library/Developer/CoreSimulator/Devices/4C571412-A637-4E82-AFA1-2F44B2172645/data/Containers/Bundle/Application/0043AA42-71E3-47D9-905D-6CF1541F7143/VYNO.app/www/index.html