ngrx 在角度应用程序中导入

问题描述 投票:0回答:3

我正在尝试导入 NGRX 来构建新的 Angular 应用程序,但当我使用 ngserve 时,我的终端出现此错误:

node_modules/@ngrx/store/src/reducer_creator.d.ts:32:99 中出现错误 - 错误 TS1005: ',' 预期。

32 导出声明函数 on(...args:[...creators:Creators,reducer:OnReducer]):ReducerTypes; ~ node_modules/@ngrx/store/src/reducer_creator.d.ts:32:118 - 错误 TS1005: ',' 预期。

32 导出声明函数 on(...args:[...creators:Creators,reducer:OnReducer]):ReducerTypes;

这是我的 Angular cli / 节点版本 / 操作系统 角度 CLI:9.1.0 节点:10.13.0 操作系统:达尔文 x64

angular ngrx
3个回答
6
投票

NgRx v11 期望使用 TypeScript 4 和 Angular 11。 https://ngrx.io/guide/migration/v11


3
投票

将@ngrx/store降级到10.2.1或更低版本。

cmd:yarn add @ngrx/[电子邮件受保护]

如果您正在使用 npm 那么

cmd:npm install @ngrx/[电子邮件受保护]


0
投票

尝试卸载或删除节点模块,然后再次通过 npm install 或 ngserve 重新安装节点模块。节点模块将再次安装,现在尝试运行错误将得到解决。

© www.soinside.com 2019 - 2024. All rights reserved.