Uncaught Exception error on packaged app


#1

I packaged and built my simple stocks app, but when I try to open it I get this error:

<img src="/uploads/github_atom/original/3X/0/c/0cc638b09331e7d9c9ded4bcfc41fc635aed2e1e.png" width="414" height="500">

Here is my package.json

{
  "name": "app",
  "version": "0.1.0",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "build": "electron-packager . StackShares --platform=darwin --arch=x64 --version=0.27.2 --overwrite"
  },
  "devDependencies": {
    "electron-packager": "^8.0.0"
  }
}

My HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Google Stock</title>

  <style>
    body {
      background: black;
      color: white;
      font-family: Arial;
      text-align: center;
    }

    .up-down {
      font-size: 30px;
    }

    .up {
      color: green;
    }

    .down {
      color: red;
    }

    .noChange {
      color: yellow;
    }

  </style>

</head>
<body style="-webkit-app-region: drag">
  <h3>Current Share Price: GOOG</h3>
  <div class="the-price" id="price"></div>

  <div class="up-down" id="priceHistory"></div>


  <script type="text/javascript">
    require("./stock.js")
  </script>

</body>
</html>

My ‘main.js’ file

const {app, BrowserWindow}= require('electron')

let win

function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({width: 200, height: 200, frame: false})
  win.loadURL(`file://${__dirname}/index.html`)

  // Emitted when the window is closed.
  win.on('closed', () => {
    win = null
  })
}
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit()
  }
})

app.on('activate', () => {
  if (win === null) {
    createWindow()
  }
})

I am using the latest recommended version of NodeJS (4.5.0) and the latest version of Electron.


#2

Hey Jordan, can’t see the image with the error.