Local Notifications not working in Ionic


#1

I implemented Local notifications using plugin https://ionicframework.com/docs/native/local-notifications/ and it works just as expected, but every time I take push my changes and take a pull again, I need to re-install the plugin and build again. Any solutions?

Running ionic info gives following on terminal:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.13.0
ionic (Ionic CLI) : 3.13.0

global packages:

cordova (Cordova CLI) : 7.0.1 

local packages:

@ionic/app-scripts : 3.0.0
Cordova Platforms  : android 6.2.3 ios 4.5.1
Ionic Framework    : ionic-angular 3.7.0

System:

ios-deploy : 1.9.2 
Node       : v6.11.3
npm        : 3.10.10 
OS         : macOS High Sierra
Xcode      : Xcode 9.0 Build version 9A235 

Misc:

backend : pro

#2

Hello Kapil,

Just a guess, do you mean a git push and a git pull on a new installation?
If this is the case did you also run

npm install

to download the dependencies?


#3

There is no Cordova information here which is strange. How are you building your app? Did you run ionic info in your app folder?


#4

Not on new installation but on already existing code.


#5

Oops! I guess I missed that, it’s updated in the question now.


#6

What does your config.xml and packages.json look like?


#7

It’s not letting me paste my config.xml file:


#8

It does. You just have to select the text and then hit the </> button so it doesn’t try to render the XML as HTML but shows the plain code.


#9

I got the fix, it was this line in my package.json file that was causing the problem:

"cordova-plugin-app-event": "file:node_modules/cordova-plugin-app-event"

Changing the path of the plugin fixed the issue.
Thanks for helping. :slight_smile:


Could not install 'node_modules/cordova-plugin-app-event'
#10

What did you fix it to?
(In another thread there is literally the same line causing problems I think…)


#11

We have node_modules in our project directory, and it was trying to look for a package.json file inside node_modules/node_modules, so there are 2 things that could be done:

  1. Change that path inside your project’s package.json
    Or,
  2. a) Copy cordova-plugin-app-event directory from inside of some other plugin (I found it inside Local Notification Plugin which can be found here “https://ionicframework.com/docs/native/local-notifications/”)
    b) Create a directory named node_modules inside already existing node_modules directory of your project.
    c) cd into /node_modules/node_modules
    d) Paste cordova-plugin-app-event directory here.

I have also provided a link to this problem in another question that I asked some time back.
Here is it: “Could not install ‘node_modules/cordova-plugin-app-event’