【发布时间】:2020-11-18 21:12:57
【问题描述】:
我在我的 angular 10 中使用 apollo,运行 ng serve 后我遇到了这个问题
目标入口点“apollo-angular”中的错误已丢失 依赖:
- @angular/core
- 阿波罗客户端
- rxjs
- rxjs/运营商
- 阿波罗链接
是否有一个命令可以在我的项目中安装所有这些缺少的依赖项......即使我认为我已经安装了所有这些......奇怪的是我有这些错误。 谁能给我一些智慧,提前谢谢你
【问题讨论】:
-
看起来你没有在你的 ngModule 中导入或声明为提供者 ApolloModule。您是否按照文档的所有步骤进行操作? apollographql.com/docs/angular/basics/setup
-
@Meadow 我确实运行了
ng add apollo-angular...你需要设置的是你的GraphQL服务器的URL,所以打开src/app/graphql.module.ts....我找不到这个文件 -
移除 apollo-angular 并重新添加。此处显示控制台中显示的 ng add 命令的完整日志。你应该有这个日志: CREATE src/app/graphql.module.ts || PS:另外,你的 Angular 版本是什么?
-
@Meadow 我卸载了所有 npm 包,重新安装了....创建了一个新项目,给了我这个:::ng add apollo-angular 跳过安装:包已安装 发生未处理的异常:找不到模块 '@angular-devkit/schematics' 需要堆栈:lar\schematics\install\index.js \@angular-devkit\schematics\tools\export-ref.js \@angular-devkit\schematics\tools\index.js \ @angular\cli\utilities\json-schema.js \@angular\cli\models\command-runner.js \@angular\cli\lib\cli\index.js _modules\@angular\cli\lib\init.js _modules\@angular\cli\bin\
-
你的@angular/cli 版本是否大于9?尝试删除 nodes_modules 文件夹并删除 package-lock.json 文件,然后执行:npm i
标签: angular apollo apollo-client apollo-angular