title: how to run electron binary in command line terminal (vty)
body: <p>I have created an electron application with express.js, the reason for developing an express application with the electron is to package an executable which runs without node installed.</p>
  
  <p>I successfully package the application in centos 7. if I double click the application binary going from centos GUI, it runs fine. when I try to run it using the command line terminal login via putty, using <code>./app</code> nothing happens, I cannot understand why.</p>
  
  <p>is there any way to run centos binary which generates from electron packager login from putty?</p>
  
  <p>source code as follows, the command I used to package is <code>npm run build</code></p>
  
  <p>Note: when I try to run it using GUI terminal using <code>./app</code> it again work fine</p>
  
  <p>main.js</p>
  
  <pre><code> const {app, BrowserWindow} = require('electron')
    const path = require('path')
    const url = require('url')
  
  var express = require('express');
  var _app = express();
  const server = require('http').Server(_app);
  let PORT = 3001;
  _app.use(express.static(__dirname + '/public'));
  
  server.listen(PORT, () =&gt; {
      console.log(`Server is running on port ${PORT}`);
  });
  
  _app.get('/', (req, res) =&gt; {
      res.sendFile(__dirname + '/index.html');
  });
  
  
    let win
  
    function createWindow () {
      win = new BrowserWindow({width: 800, height: 600})
  
      win.loadURL(url.format({
        pathname: path.join(__dirname, 'index.html'),
        protocol: 'file:',
        slashes: true
      }))
  
      win.webContents.openDevTools()
  
      win.on('closed', () =&gt; {
        win = null
      })
    }
  
    app.on('ready', createWindow)
  
    app.on('window-all-closed', () =&gt; {
      if (process.platform !== 'darwin') {
        app.quit()
      }
    })
  
    app.on('activate', () =&gt; {
      if (win === null) {
        createWindow()
      }
    })
  </code></pre>
  
  <p>package.json</p>
  
  <pre><code>    {
    "name": "myapp",
    "version": "1.0.0",
    "description": "",
    "main": "main.js",
    "scripts": {
      "start": "electron .",
      "build": "electron-packager . app --platform linux --arch x64 --out dist/",
      "rpm64": "electron-installer-redhat --src dist/app-linux-x64/ --dest dist/installers/ --arch x86_64",
      "pack": "build --dir",
      "dist": "build"
    },
    "build": {
      "appId": "myapp",
      "category": "your.app.category.type",
      "dmg": {
        "contents": [
          {
            "x": 110,
            "y": 150
          },
          {
            "x": 240,
            "y": 150,
            "type": "link",
            "path": "/root/projects/myapp"
          }
        ]
      },
      "linux": {
        "target": [
          "AppImage",
          "deb"
        ]
      },
      "win": {
        "target": "squirrel",
        "icon": "build/icon.ico"
      }
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "electron": "^2.0.0",
      "electron-builder": "^20.11.1",
      "electron-installer-redhat": "^0.5.0",
      "electron-packager": "*",
      "electron-prebuilt": "*"
    },
    "dependencies": {
      "electron-terminal-open": "^0.1.1",
      "express": "^4.16.3"
    }
  </code></pre>