sách gpt4 ăn đã đi

Angular 编译器找不到 jasmine.CustomMatchers,即使它在 @types/jasmine 中

In lại 作者:太空狗 更新时间:2023-10-29 18:35:56 26 4
mua khóa gpt4 giày nike

我刚刚从 Angular guide 下载了示例测试项目: ../../../generated/zips/testing/testing.zip

Khi tôi thực thi ng serve 时出现错误:

src/testing/jasmine-matchers.d.ts(3,67):错误 TS2694:命名空间“jasmine”没有导出成员“CustomMatcher”。

我是 Angular 的新手。有人可以帮助我了解问题所在吗?

我已经完成了 cài đặt npm,当我转到 node_modules/@types/jasmine 时,我可以看到 CustomMatchers 是在 index.d.ts 中定义的

Angular 7

typescript 3.0

"@types/jasmine": "^2.8.14",
"@types/jasminewd2": "^2.0.4",
"@types/node": "~8.9.4",
"jasmine-core": "~2.99.1",
"jasmine-marbles": "^0.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~3.0.0",

câu trả lời hay nhất

事实证明,错误是由 Typescript 和 @types/jasmine 包的不兼容版本引起的。以下版本应该可以工作:

Angular CLI: 6.2.9
Node: 10.11.0
OS: darwin x64
Angular: 6.1.10
typescript 2.7.2
"@types/jasmine": "2.8.9"

为了安装正确的版本,请执行以下操作:

xóa bỏ package-lock.jsonnode_modules/ 然后执行 npm cache clean --forcecài đặt npm

关于Angular 编译器找不到 jasmine.CustomMatchers,即使它在 @types/jasmine 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54244040/

26 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress