title: Electron-packager - The "path" argument must be of type string. Received type undefined
body: <p>I have been struggling with this issue and could not figure it out. Similar problems were posted which solutions suggested node version had a glitch or package versions should be down/upgraded. I have tried it with modifying the node versions, reverifying the npm cache and many other fiddles, none worked for me. (it happens during running the app-> electron)</p>
  
  <blockquote>
    <p>Uncaught Exception:
    TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
        at assertPath (path.js:39:11)
        at basename (path.js:1299:5)
        at Command.parse (/Users/ben.izadi/Documents/Developer/gsa-cloud-portal/ui/electron_app/publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/node_modules/commander/index.js:462:30)
        at dispatchUploadFileMessageFromArgs (/Users/ben.izadi/Documents/Developer/gsa-cloud-portal/ui/electron_app/publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/index.js:38:4)
        at WebContents.win.webContents.on (/Users/ben.izadi/Documents/Developer/gsa-cloud-portal/ui/electron_app/publishTest2-mas-x64/publishTest2.app/Contents/Resources/app/index.js:11:5)
        at WebContents.emit (events.js:182:13)</p>
  </blockquote>
  
  <p>inside my index.js:</p>
  
  <pre><code>const { app, BrowserWindow } = require('electron')
  var program = require('commander');
  path = require('path');
  
  var win = null;
  
  function createWindow() {
    win = new BrowserWindow({ width: 1024, height: 768 })
    win.loadFile('./app/index.html');
    win.webContents.on('did-finish-load', () =&gt; {
      dispatchUploadFileMessageFromArgs(process.argv);
    })
  }
  
  const instanceLock = app.requestSingleInstanceLock();
  if (!instanceLock) {
    app.quit()
  } else {
    app.on('second-instance', (event, argv, workingDirectory) =&gt; {
      if (win) {
        if (win.isMinimized()) {
          win.restore();
        }
        win.focus();
        dispatchUploadFileMessageFromArgs(argv);
      }
    })
  
    app.on('ready', createWindow);
  }
  
  function dispatchUploadFileMessageFromArgs(argv) {
    program
    .option(
      "-m, --modelfile [modelfile]",
      "Model to analyse in the GSA Cloud Platform"
    )
    .parse(argv);
  
    if (program.modelfile) {
      var absolutePath = path.resolve(program.modelfile);
      var basename = path.basename(absolutePath);
      win.webContents.send("upload-model-file", basename + "," + absolutePath);
    }
  }
  </code></pre>
  
  <p>Package.json:</p>
  
  <pre><code>{
    "name": "gsa-portal-electron",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "start": "electron .",
      "start:withfile": "electron . --modelfile ./stairs.gwb",
      "test": "run-script-os",
      "test:win32": "cd node_modules\\mocha\\bin &amp; mocha ..\\..\\..\\tests\\without_upload\\*.spec.js",
      "test:darwin:linux": "./node_modules/mocha/bin/mocha tests/without_upload/*.spec.js",
      "test:ci": "xvfb-maybe ./node_modules/mocha/bin/mocha tests/without_upload/*.spec.js",
      "testupload": "run-script-os",
      "testupload:win32": "cd node_modules\\mocha\\bin &amp; mocha ..\\..\\..\\tests\\upload\\*.spec.js",
      "testupload:darwin:linux": "./node_modules/mocha/bin/mocha tests/upload/*.spec.js",
      "testupload:ci": "xvfb-maybe ./node_modules/mocha/bin/mocha tests/upload/*.spec.js"
  
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
      "chai": "^4.2.0",
      "chai-as-promised": "^7.1.1",
      "electron": "^3.0.10",
      "electron-reload": "^1.3.0",
      "mocha": "^5.2.0",
      "run-script-os": "^1.0.3",
      "spectron": "^5.0.0"
    },
    "dependencies": {
      "commander": "^2.19.0"
    }
  }
  </code></pre>