gpt4 book ai didi

angular - Angular 更新后无法启动 Electron Angular 应用程序

转载 作者:行者123 更新时间:2023-12-03 12:33:54 27 4
gpt4 key购买 nike

我正在尝试使用 angular、TypeORM、SQLite 和其他组件作为 webpack 构建 Electron 应用程序。

我从在 GitHub 上找到的示例开始我的开发:https://github.com/CubikNeRubik/angular-electron-typeorm-starter .

过了一会儿,我决定将 angular 从 8.0 更新到 8.2。然后就无法启动我的应用程序。我有一个错误“ReferenceError:未定义路径”。

我从 Angular 的 8.0 版本开始重新开始。无需更改任何内容,应用程序即可正常启动。

我使用“npm update”命令升级了项目。

然后我得到了这个错误:

[error] ReferenceError: path is not defined
at Object.getBrowserConfig (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js:62:22)
at webpack_browser_config_1.generateBrowserWebpackConfigFromContext.wco (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/browser/index.js:55:27)
at scriptTargets.map.scriptTarget (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:69:26)
at Array.map (<anonymous>)
at generateWebpackConfig (/Volumes/Data/ProjetNodes/TestUpdate/node_modules/@angular-devkit/build-angular/src/utils/webpack-browser-config.js:33:26)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

有人可以解释我的错误吗?

这里是更新前使用的模块版本:
"dependencies": {
"sqlite3": "^4.0.9",
"typeorm": "^0.2.18"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.0.2",
"@angular-devkit/architect": "^0.800.3",
"@angular-devkit/build-angular": "^0.800.3",
"@angular-devkit/core": "^8.0.3",
"@angular/animations": "^8.0.1",
"@angular/cdk": "^8.0.1",
"@angular/cli": "~8.0.3",
"@angular/common": "^8.0.1",
"@angular/compiler": "^8.0.1",
"@angular/compiler-cli": "^8.0.1",
"@angular/core": "^8.0.1",
"@angular/forms": "^8.0.1",
"@angular/http": "^7.0.0",
"@angular/language-service": "^8.0.1",
"@angular/material": "^8.0.1",
"@angular/platform-browser": "^8.0.1",
"@angular/platform-browser-dynamic": "^8.0.1",
"@angular/router": "^8.0.1",
"@types/node": "~12.0.8",
"angular-cli-builders": "^2.1.2",
"codelyzer": "~5.1.0",
"commonjs": "0.0.1",
"copy-webpack-plugin": "^5.0.3",
"core-js": "^3.1.4",
"electron": "^5.0.4",
"electron-builder": "^20.44.2",
"electron-reload": "^1.4.0",
"fs": "0.0.1-security",
"hammerjs": "^2.0.8",
"npm-run-all": "4.1.5",
"npx": "^10.2.0",
"rxjs": "^6.5.2",
"stream": "0.0.2",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "^3.4.5",
"wait-on": "3.2.0",
"webpack": "^4.34.0",
"zone.js": "^0.9.1"
}

更新后的版本:
"dependencies": {
"sqlite3": "^4.1.1",
"typeorm": "^0.2.22"
},
"devDependencies": {
"@angular-builders/custom-webpack": "^8.4.1",
"@angular-devkit/architect": "^0.800.6",
"@angular-devkit/build-angular": "^0.803.25",
"@angular-devkit/core": "^8.3.25",
"@angular/animations": "^8.2.14",
"@angular/cdk": "^8.2.3",
"@angular/cli": "~8.3.25",
"@angular/common": "^8.2.14",
"@angular/compiler": "^8.2.14",
"@angular/compiler-cli": "^8.2.14",
"@angular/core": "^8.2.14",
"@angular/forms": "^8.2.14",
"@angular/http": "^7.2.16",
"@angular/language-service": "^8.2.14",
"@angular/material": "^8.2.3",
"@angular/platform-browser": "^8.2.14",
"@angular/platform-browser-dynamic": "^8.2.14",
"@angular/router": "^8.2.14",
"@types/node": "^12.0.12",
"angular-cli-builders": "^2.1.2",
"codelyzer": "^5.1.2",
"commonjs": "0.0.1",
"copy-webpack-plugin": "^5.1.1",
"core-js": "^3.6.4",
"electron": "^5.0.13",
"electron-builder": "^20.44.4",
"electron-reload": "^1.5.0",
"fs": "0.0.1-security",
"hammerjs": "^2.0.8",
"npm-run-all": "4.1.5",
"npx": "^10.2.2",
"rxjs": "^6.5.4",
"stream": "0.0.2",
"ts-node": "~8.3.0",
"tslint": "~5.17.0",
"typescript": "^3.5.3",
"wait-on": "3.2.0",
"webpack": "^4.41.6",
"zone.js": "^0.9.1"
}

最佳答案

对于那些在这里遇到同样问题的人是我的巡回赛。
我只是在“node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js”文件中添加代码:

const path = require("path");
等等瞧。
今天过得愉快

关于angular - Angular 更新后无法启动 Electron Angular 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60413946/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com