May*_*ank 5 graphql apollo-server typegraphql
我一直在尝试在 typescript 节点模板中使用 apollo/server 安装 typegraphql 但它显示依赖项错误,我不知道为什么所有新版本彼此不兼容。
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: server@1.0.0
npm ERR! Found: graphql@16.6.0
npm ERR! node_modules/graphql
npm ERR! graphql@"*" from the root project
npm ERR! peer graphql@"^16.6.0" from @apollo/server@4.3.0
npm ERR! node_modules/@apollo/server
npm ERR! @apollo/server@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! type-graphql@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: graphql@15.8.0
npm ERR! node_modules/graphql
npm ERR! peer graphql@"^15.3.0" from type-graphql@1.1.1
npm ERR! node_modules/type-graphql
npm ERR! type-graphql@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
$ npm i @apollo/server express graphql reflect-metadata type-graphql
Run Code Online (Sandbox Code Playgroud)
强制它应该有效还是会导致数据泄漏等?预先感谢您的回复
的最新版本type-graphql仅适用于graphqlversion ^15.5.0。@apollo/server另一方面,几乎所有较新版本的和 graphql 相关库仅支持graphql版本>= 16. type-graphql幸运的是, (版本)的较新版本2.0.0(仍处于测试阶段)可以在next标签版本下使用npm。要安装它,请先卸载type-graphql,然后指定标签重新安装next:
npm uninstall type-graphql
npm install type-graphql@next
Run Code Online (Sandbox Code Playgroud)
PS:如果您想查看一个工作示例项目,请查看此.
| 归档时间: |
|
| 查看次数: |
853 次 |
| 最近记录: |