Vaibhav Sharma Vaibhav Sharma - 5 months ago 92
Javascript Question

I'm getting an error while running main.js. " Cannot find module 'app' ". Could anyone help me out

index.html

Hello World!



main.js
'use strict';

var app = require('app');
var BrowserWindow = require('browser-window');

var mainWindow = null;

app.on('ready', function() {
mainWindow = new BrowserWindow({
height: 600,
width: 800
});

mainWindow.loadUrl('file://' + __dirname + '/app/index.html');


});

Answer

From http://electron.atom.io/blog/2015/11/17/electron-api-changes:

Built-in modules are now grouped into one module, instead of being separated into independent modules, so you can use them without conflicts with other modules:

var app = require('electron').app
var BrowserWindow = require('electron').BrowserWindow

Also loadUrl() was renamed to loadURL()

Comments