title: ipcMain: event.reply is not a function
body: <p>I've made a simple <code>Electron</code> app which uses <code>ipcMain</code> and <code>ipcRenderer</code>. Here is the code, which makes sense:</p>
  
  <p><strong><em>main.js</em></strong></p>
  
  <pre><code>const { app, BrowserWindow, ipcMain } = require('electron')
  const { spawn, exec } = require('child_process')
  
  let win
  
  function createWindow() {
      win = new BrowserWindow({
        width: 800,
        height: 600,
        minWidth: 610,
        minHeight: 470,
        webPreferences: {
          nodeIntegration: true
        }
      })
  
    win.loadFile('index.html')
    win.webContents.openDevTools()
  }
  
  app.on('ready', createWindow)
  
  ipcMain.on("checkPerl", function(e){
      tryToRun("perl", ["-v"])
          .then(function(){ e.reply("checkPerlReply", true) })
          .catch(function(){ e.reply("checkPerlReply", false) })
  
  })
  
  function tryToRun(cmd, args){
    return new Promise(function(resolve, reject){ 
      // some code 
    })
  }
  </code></pre>
  
  <p><strong><em>renderer.js</em></strong></p>
  
  <pre><code>const { ipcRenderer } = require('electron')
  
  class Chdump {
  
      checkPerl(){
          this.message("Проверяем Perl...")
          let p = new Promise(function(resolve, reject){
              ipcRenderer.send("checkPerl", true)
              ipcRenderer.on("checkPerlReply", function(event, res){
                  if (res) resolve()
                  else reject()
              })
          })
          return p
      }
  
      start(){
          let self = this
          this.checkPerl()
          .then(function(){ console.log("Perl is installed") })
          .catch(function(){ console.log("Perl is not installed") })
      }
  }
  
  let app = new Chdump()
  app.start()
  </code></pre>
  
  <p>I skipped some code, that is not relevant to the problem. 
  This code runs normally when I run it with NodeJS, using <code>electron .</code>, but after packaging the app I'm getting the following error:</p>
  
  <pre><code>UnhandledPromiseRejectionWarning: TypeError: e.reply is not a function
  </code></pre>
  
  <p>This error referencing to the following string in the main.js:</p>
  
  <pre><code>    tryToRun("perl", ["-v"])
          .then(function(){ e.reply("checkPerlReply", true) })
          .catch(function(){ e.reply("checkPerlReply", false) })
  </code></pre>
  
  <p>I've added <code>console.log(e)</code> to look at event object and got the following contents:</p>
  
  <pre><code>{ preventDefault: [Function: preventDefault],
    sender:
     WebContents {
       webContents: [Circular],
       history:
        [ 'file:///home/kolesnikov/changedump/resources/app/index.html' ],
       currentIndex: 0,
       pendingIndex: -1,
       inPageIndex: -1,
       _events:
        { 'navigation-entry-commited': [Function],
          'ipc-message': [Function],
          'ipc-message-sync': [Function],
          'pepper-context-menu': [Function],
          '-did-get-response-details': [Function],
          '-did-get-redirect-request': [Function],
          'devtools-reload-page': [Function],
          '-new-window': [Function],
          '-web-contents-created': [Function],
          '-add-new-contents': [Function],
          'will-navigate': [Function],
          'did-navigate': [Function],
          destroyed: [Function],
          'devtools-opened': [Function],
          move: [Function],
          activate: [Function],
          'page-title-updated': [Function] },
       _eventsCount: 17,
       _maxListeners: 0,
       browserWindowOptions:
        { width: 800,
          height: 600,
          minWidth: 610,
          minHeight: 470,
          webPreferences: [Object] } } }
  </code></pre>
  
  <p>I tried to do same with non-packaged app, which runs with NodeJS and I got suprisingly different result:</p>
  
  <pre><code>{ preventDefault: [Function: preventDefault],
    // [...] looks the same as a previous object
    frameId: 1,
    reply: [Function] }
  </code></pre>
  
  <p>The second <code>Event</code> object looks fine, and it has a <code>reply</code> property. I'm still didn't understand, why the <code>electron</code> Event object has no <code>reply</code> property after packaging. </p>
  
  <p>Do you have any ideas?</p>