Shr*_*wal 5 graphql-js apollo-client angular
ng add apollo-angular
Run Code Online (Sandbox Code Playgroud)
它发出了许多警告:
UPDATE src/app/app.module.ts (541 bytes)
npm WARN notsup Unsupported engine for extract-files@9.0.0: wanted: {"node":"^10.17.0 || ^12.0.0 || >= 13.7.0"} (current: {"node":"10.16.3","npm":"6.12.0"})
npm WARN notsup Not compatible with your version of node/npm: extract-files@9.0.0
npm WARN karma-jasmine-html-reporter@1.5.4 requires a peer of jasmine-core@>=3.5 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/client@3.1.3 requires a peer of react@^16.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN @apollo/client@3.1.3 requires a peer of subscriptions-transport-ws@^0.9.0 but none is installed. You must install peer dependencies yourself.
Run Code Online (Sandbox Code Playgroud)
因此,在添加对等依赖项后,我尝试再次添加 apollo-angular:
MIA-LT-16354:src SSilwal$ ng add apollo-angular
Skipping installation: Package already installed
? Url to your GraphQL endpoint https://o5x5jzoo7z.sse.codesandbox.io/graphql'
Couldn't read tsconfig.base.json!
Run Code Online (Sandbox Code Playgroud)
环境:
@apollo/client: 3.0.0 apollo-angular:2.0.3 graphql:15.3.0 @angular/core:9.1.7 @angular/cli: 9.1.12 typescript:3.8.3
此问题通常发生在您的 Angular 项目之前进行过版本迁移,导致 Angular 项目tsconfig.base.json缺失或无效。
您可以apollo-angular按照官方文档的指导尝试手动安装
Apollo Angular 官方指南apollo-angular,无需 Angular 原理图 即可安装
或按照我在下面提到的本手册更新:
问题作者提出的 Github 问题提供了仅更新 Angular 版本的修复方法,请先尝试此操作
在我遇到这个问题期间,使用下面的命令帮助了一些人,但没有解决我的问题
免费尝试
ng update @angular/cli --migrate-only --from 9 --to 10
ng update @angular/core --migrate-only --from 9 --to 10
Run Code Online (Sandbox Code Playgroud)
或者如果遇到错误,请尝试使用 --force (谨慎使用!!)
tsconfig.base.json这是为解决迁移 Angular 版本引起的问题而提供的解决方案
主要来源:与此问题相关的 Github 问题
请注意,它有一些副作用
在Angulars 官方文档中阅读有关如何根据项目复杂程度正确迁移的更多信息
我个人使用此命令来安装所需的所有软件包,并继续按照指南添加所需的模块。
ng update apollo-angular --migrate-only --from 1.10.0
Run Code Online (Sandbox Code Playgroud)
或者如果遇到错误,请尝试使用 --force (谨慎使用!!)
ng update apollo-angular --migrate-only --from 1.10.0 --force
Run Code Online (Sandbox Code Playgroud)
PS在伊朗等部分国家,可能需要使用代理才能使用
ng add apollo-angular
| 归档时间: |
|
| 查看次数: |
1677 次 |
| 最近记录: |