Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No notifications on macOS after build #272

Open
kevinelliott opened this issue Mar 6, 2019 · 14 comments
Open

No notifications on macOS after build #272

kevinelliott opened this issue Mar 6, 2019 · 14 comments

Comments

@kevinelliott
Copy link

I am getting notifications in my Electron app when it is in dev mode, but after it is built there are no notifications present.

I have my build setup with:

  node: {
    __filename: true,
    __dirname: true
  },

to account for webpacker and I also have my development and distribution profiles setup in Xcode which are detected during an Electron build. So I can (mostly) eliminate most of the common Electron and electron-builder issues that could cause node-notifier to be a problem.

Any thoughts here? I have no errors in the Console logging app.

What could be causing this?

@kevinelliott
Copy link
Author

Any thoughts?

@Ivorfason
Copy link

the same here

@Ghefest
Copy link

Ghefest commented Mar 25, 2019

the same problem on windows

@Noitidart
Copy link

Noitidart commented Apr 7, 2019

Same problem here on macOS. When in dev mode it works fine, but when prod it doesnt' work.

It is working in dev mode even though I have:

  node: {
    __dirname: false,
    __filename: false
  },

I am using https://github.com/electron-react-boilerplate/electron-react-boilerplate boilerplate.

@Aarbel
Copy link
Contributor

Aarbel commented Apr 14, 2019

same here

@Aarbel
Copy link
Contributor

Aarbel commented Apr 14, 2019

My package.json (scroll it)
I run electron-builder -m to pack my app.

{
  
  "main": "main.js",
  "scripts": {
    "postinstall": "electron-builder install-app-deps",
    "start": "electron main.js",
    "pack": "build --dir",
    "dist": "build"
  },
  "build": {
    "appId": "my.app.id",
    "dmg": {
      "contents": [
        {
          "x": 110,
          "y": 270
        },
        {
          "x": 370,
          "y": 270,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "mac": {
      "category": "productivity",
      "extendInfo": {
        "CFBundleURLName": "myapp",
        "CFBundleURLSchemes": [
          "myapp"
        ]
      }
    },
  },
  "dependencies": {
    "electron-is-dev": "^1.1.0",
    "electron-updater": "^4.0.6",
    "electron-window-state": "^5.0.3",
    "node-notifier": "^5.4.0",
    "url-parse": "^1.4.6"
  },
  "devDependencies": {
    "asar": "^1.0.0",
    "electron": "^4.1.4",
    "electron-builder": "^20.39.0",
    "electron-packager": "^13.1.1",
    "electron-reloader": "^0.2.0"
  }
}

@Aarbel
Copy link
Contributor

Aarbel commented Apr 14, 2019

@mikaelbr

I tried with this instruction : https://github.com/mikaelbr/node-notifier#within-electron-packaging.

That generates very heavy .dmg and .zip files, and node-notifier still don't work.

Moreover i don't have errors in my Developer Console. notifier is loaded.

Electron renderer.js

var notifier = require('node-notifier');


function Notify() {
    console.log('Notify');

    notifier.notify({
      'title': 'BLABLA',
      'subtitle' : 'BLABLA1',
      'message': 'BLABLA2',
      'closeLabel': 'Close',
      'actions': ['Open'],
      'sound': 'Pop',
      'wait': true,
    });
}

Developer Tools screenshot
image

@Aarbel
Copy link
Contributor

Aarbel commented Apr 14, 2019

After working one full day on node-notifier problems with Electron, i chose to use node-mac-notifier which works great under production.
node-notifier library seems powerful and has many stars, but many people seems to face build problems, even for windows. We could come back with node-notifier if stability with Electron comes true.

As an example Slack use node-mac-notifier and electron-windows-notifications which are stable versions, even for very old versions of Electron. You don't have as many options but that works.

@ReAlign
Copy link

ReAlign commented May 5, 2019

You may need this: node-notifier-in-electron-vue

@Noitidart
Copy link

@ReAlign that's interesting, thanks for sharing. Even if wearen't using Vue though?

@ReAlign
Copy link

ReAlign commented May 5, 2019

@Noitidart no, it‘s is just a simple handling of the situation ,

I am just simple processing, ensure that can be used.

@pablopunk
Copy link

I fixed it with "asar": false in my build config

@leekangtaqi
Copy link

leekangtaqi commented Feb 11, 2020

@Noitidart add asarUnpack option to electron-builder

"build": {
    "asarUnpack": [
      "./node_modules/node-notifier/vendor/**"
    ],
    ...
}

@lee-gyu
Copy link

lee-gyu commented Dec 18, 2020

@leekangtaqi Thanks! You made my day!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants