上下文: :我 见过 this question,但不能解决我的问题。< / p>
当我尝试运行我的电子应用程序时,我没有收到任何错误,并且似乎可以编译,但是电子窗口没有弹出。
响应:
Date: 2019-05-08T03:02:22.036Z
Hash: 3303fd48d099a538493f
Time: 13840ms
chunk {0} runtime.26209474bfa8dc87a77c.js (runtime) 1.41 kB [entry]
[rendered]
chunk {1} es2015-polyfills.c5dd28b362270c767b34.js (es2015-polyfills)
56.4 kB [initial] [rendered]
chunk {2} main.8b6835f39caf5eafd09d.js (main) 276 kB [initial]
[rendered]
chunk {3} polyfills.8bbb231b43165d65d357.js (polyfills) 41 kB [initial]
[rendered]
chunk {4} styles.3ff695c00d717f2d2a11.css (styles) 0 bytes [initial]
[rendered]
^似乎是完全正常的反应
此后不久,它退出而不显示任何错误代码。
主文件:
const { app, BrowserWindow } = require ('electron')
let win;
function createWindow() {
//Create the browser window
win = new BrowserWindow({
width: 600,
height: 600,
backgroundColor: '#ffffff',
//icon: 'file:///' + __dirname + '/dist/assets/favicon.ico'
})
win.loadURL('file:///' + __dirname + '/index.html')
win.on('close', function() {
win = null
})
}
// Create window on electron intialization
app.on('ready', createWindow)
//Quit when all windows are closed
app.on('window-all-closed', function(){
// On macOS specific close process
if(process.platform !== 'darwin'){
app.quit()
}
})
app.on('activate', function(){
//macOS specific close process
if(win === null){
createWindow()
}
})
HTML文件:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bot</title>
<base href="./">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
Package.json文件:
{
"name": "shopify-bot",
"version": "0.0.0",
"license": "MIT",
"main": "main.js",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "electron .",
"electron-build": "ng build --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "~7.2.0",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
"@angular/router": "~7.2.0",
"core-js": "^2.5.4",
"node-html-parser": "^1.1.15",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.13.9",
"@angular/cli": "~7.3.8",
"@angular/compiler-cli": "~7.2.0",
"@angular/language-service": "~7.2.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.5.0",
"electron": "^5.0.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~1.1.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.11.0",
"typescript": "~3.2.2"
}
}
我对棱角还很陌生,所以任何帮助将不胜感激!