简体   繁体   中英

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

index.html

<h1>Hello World!</h1>

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');
});

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM