我用电子创建了一个新的角投影。我确实需要设置电子。
我遇到了以下错误。
./node_modules/electron/index.js中的错误
未找到模块:错误:无法解析'D:\ PATH \ desktop \ node_modules \ electron'中的'fs'
我的package.json文件
{
"name": "desktop",
"version": "0.0.0",
"main": "main.js",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "ng build && electron .",
"electron-aot": "ng build --prod && electron ."
},
"private": true,
"dependencies": {
"@angular/animations": "~7.1.0",
"@angular/common": "~7.1.0",
"@angular/compiler": "~7.1.0",
"@angular/core": "~7.1.0",
"@angular/forms": "~7.1.0",
"@angular/platform-browser": "~7.1.0",
"@angular/platform-browser-dynamic": "~7.1.0",
"@angular/router": "~7.1.0",
"core-js": "^2.5.4",
"rxjs": "~6.3.3",
"tslib": "^1.9.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.11.0",
"@angular/cli": "~7.1.1",
"@angular/compiler-cli": "~7.1.0",
"@angular/language-service": "~7.1.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.9.5",
"codelyzer": "~4.5.0",
"electron": "^4.1.4",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.1.1",
"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.1.6"
}
}
答案 0 :(得分:0)
升级后我遇到了同样的问题,因为模板使用了一个 hack 来允许在构建时使用节点库。我通过重新查看模板及其解决方法来解决它:https://github.com/maximegris/angular-electron
我知道这不是您的具体情况,但我认为您(或任何查看此内容以供参考的人)可以通过从工作模板重新开始并将配置复制到您自己的应用程序来解决此问题。