gpt4 book ai didi

angular - 从 Angular 8 通用版迁移到 9 通用版失败 : require. 解析不是函数

转载 作者:行者123 更新时间:2023-12-05 06:02:05 25 4
gpt4 key购买 nike

enter image description here

挖掘 Angular 错误,我发现了以下错误:

 [error] TypeError: require.resolve is not a function
at SchematicImpl.<anonymous> (E:\B2C-NG-9\b2c\node_modules\@nguniversal\express-engine\schematics\migrations\update-9\index.js:42:44)
at Generator.next (<anonymous>)
at E:\B2C-NG-9\b2c\node_modules\@nguniversal\express-engine\schematics\migrations\update-9\index.js:20:71
at new Promise (<anonymous>)
at __awaiter (E:\B2C-NG-9\b2c\node_modules\@nguniversal\express-engine\schematics\migrations\update-9\index.js:16:12)
at E:\B2C-NG-9\b2c\node_modules\@nguniversal\express-engine\schematics\migrations\update-9\index.js:38:26
at MergeMapSubscriber.project (C:\Users\YOURTR~1\AppData\Local\Temp\angular-cli-packages-YWauXm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
at MergeMapSubscriber._tryNext (C:\Users\YOURTR~1\AppData\Local\Temp\angular-cli-packages-YWauXm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:67:27)
at MergeMapSubscriber._next (C:\Users\YOURTR~1\AppData\Local\Temp\angular-cli-packages-YWauXm\node_modules\@angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:57:18)
at MergeMapSubscriber.Subscriber.next (C:\Users\YOURTR~1\AppData\Local\Temp\angular-cli-packages-YWauXm\node_modules\@angular\cli\node_modules\rxjs\internal\Subscriber.js:66:18)

最佳答案

我就是这样做的。

我临时替换了这个文件中的代码(在尝试 ng update 之后)node_modules/@nguniversal/express-engine/schematics/migrations/update-9/index.js: 36 到:

const collectionPath = require.hasOwnProperty('resolve') ? require.resolve('../../collection.json') : '@nguniversal/express-engine/schematics/collection.json';

然后我跑了:

ng update @nguniversal/express-engine@9 --allow-dirty --migrate-only --from=8

仅迁移 - 不还原和删除新的迁移文件

关于angular - 从 Angular 8 通用版迁移到 9 通用版失败 : require. 解析不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67025664/

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