danielsogl / awesome-cordova-plugins

Native features for mobile apps built with Cordova/PhoneGap and open web technologies. Complete with TypeScript support.
https://danielsogl.gitbook.io/awesome-cordova-plugins/
Other
2.41k stars 2.42k forks source link

@ionic-native/localnotifications not working properly #1136

Closed Sh1d0w closed 7 years ago

Sh1d0w commented 7 years ago

Trying to install

npm install @ionic-native/localnotifications --save

Fails to install with

module.js:472
    throw err;
    ^

Error: Cannot find module '@ionic-native/utils'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at [eval]:1:1
    at ContextifyScript.Script.runInThisContext (vm.js:23:33)
    at Object.exports.runInThisContext (vm.js:74:17)
    at Object.<anonymous> ([eval]-wrapper:6:22)
    at Module._compile (module.js:571:32)
    at Immediate.<anonymous> (bootstrap_node.js:387:29)
npm WARN @ionic-native/local-notifications@3.1.0-alpha.1 requires a peer of @ionic-native/core@3.1.0-alpha.1 but none was installed.
npm WARN @ionic-native/local-notifications@3.1.0-alpha.1 requires a peer of @ionic-native/utils@3.1.0-alpha.1 but none was installed.
npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/Cellar/node/7.6.0/bin/node" "/usr/local/bin/npm" "install" "@ionic-native/local-notifications" "--save"
npm ERR! node v7.6.0
npm ERR! npm  v4.1.2
npm ERR! code ELIFECYCLE

npm ERR! @ionic-native/local-notifications@3.1.0-alpha.1 postinstall: `node -e "require('@ionic-native/utils').install(require('./plugin-config.json'))"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @ionic-native/local-notifications@3.1.0-alpha.1 postinstall script 'node -e "require('@ionic-native/utils').install(require('./plugin-config.json'))"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the @ionic-native/local-notifications package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node -e "require('@ionic-native/utils').install(require('./plugin-config.json'))"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs @ionic-native/local-notifications
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls @ionic-native/local-notifications
npm ERR! There is likely additional logging output above.

Manually installing @ionic-native/core@3.1.0-alpha.1 and @ionic-native/utils@3.1.0-alpha.1 before that makes the installation to pass, but then the plugin can not be used due to: none of the class methods are recognized:

[18:53:57]  typescript: src/pages/reminders/reminders.ts, line: 37 
            Property 'getScheduledIds' does not exist on type 'typeof LocalNotifications'. 

      L37:      LocalNotifications.getScheduledIds()

I have other ionic-native plugins as well installed like AppVersion and Statusbar, they all require @ionic-native/core@3.0.0 and they work ok.

Ionic info:

Your system information:

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.0 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v7.6.0
Xcode version: Xcode 8.2.1 Build version 8C1002
ihadeed commented 7 years ago

@Sh1d0w please read my comment here: https://github.com/driftyco/ionic-native/issues/1134#issuecomment-283669578

If you don't wish to use the injectable plugins, stick with @ionic-native/*@3.0.0. Also, avoid 3.1.0.alpha.1 and 3.0.0.alpha.2 as they contained experimental changes.