Electron application not launching

Viewed 5975

I am new to Electron and was trying to create a simple application. I dont want to install electron globally. Rather, want it installed only in the application. When I run npm run start, nothing happens. Just eletron . gets displayed on the command line. What is wrong with my code and anywhere where I can see the logs

My appstructure: MusicPlayer

  • app-> index.html
  • node_modules
  • main.js
  • package.json

Package.json is:

{
  "name": "musicplayer",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "start": "electron ."
  },
  "author": "ABC",
  "devDependencies": {
    "electron": "^1.6.11"
  }

}

Main.js is:

const electron = require ('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
var mainWindow = null;

function createWindow()
{
    mainWindow = new BrowserWindow({width:612,height:384});
    mainWindow.loadURL(`file://${__dirName}/app/index.html`);
}

app.on('ready', createWindow)

1 Answers
Related