Reactjs 多版本graphql的盖茨比-纱线分辨率
我从盖茨比开始。正在尝试使用Reactjs 多版本graphql的盖茨比-纱线分辨率,reactjs,npm,graphql,gatsby,Reactjs,Npm,Graphql,Gatsby,我从盖茨比开始。正在尝试使用gatsby源pg插件。但面临多个graphql版本的问题。我在github上向这个插件的作者询问了这个问题,他在回答我的问题时帮了我很大的忙 但也许我错过了什么 问题- 非常感谢您的帮助。啊。。找出正确的版本是很棘手的 我用gatsby new创建了一个新项目,并安装了npm。 使用npm安装的已安装插件——保存gatsby source pg 在此之后,我在node\u modules中搜索名为graphql的文件夹,然后准备以下解决方案列表- "r
gatsby源pg
插件。但面临多个graphql版本的问题。我在github上向这个插件的作者询问了这个问题,他在回答我的问题时帮了我很大的忙
但也许我错过了什么
问题-
非常感谢您的帮助。啊。。找出正确的版本是很棘手的 我用
gatsby new
创建了一个新项目,并安装了npm
。
使用npm安装的已安装插件——保存gatsby source pg
在此之后,我在node\u modules
中搜索名为graphql
的文件夹,然后准备以下解决方案列表-
"resolutions":{
"eslint-plugin-graphql/graphql": "14.1.1",
"express-graphql/graphql": "14.1.1",
"graphql-tools/graphql": "14.1.1",
"apollo-link/graphql": "14.1.1",
"apollo-utilities/graphql": "14.1.1",
"gatsby-source-graphql/graphql": "14.1.1",
"gatsby-source-pg/graphql": "14.1.1",
"@types/graphql": "14.1.1"
}
但不知何故,当我安装warn
时,@types
说它不喜欢14.1.1
,并提供了一系列版本。我从显示的列表中选择了最新的一个,14.0.7
,然后继续安装。它仍然生成如下警告-
yarn install
yarn install v1.12.3
info No lockfile found.
[1/4] Resolving packages...
Couldn't find any versions for "@types/graphql" that matches "14.1.1"
? Please choose a version of "@types/graphql" from this list: 14.0.7
warning Resolution field "graphql@14.1.1" is incompatible with requested version "graphql@0.13.x"
[2/4] Fetching packages...
info fsevents@1.2.7: The platform "win32" is incompatible with this module.
info "fsevents@1.2.7" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "gatsby > express-graphql@0.6.12" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
warning "gatsby > eslint-plugin-graphql@2.1.1" has incorrect peer dependency "graphql@^0.12.0 || ^0.13.0".
warning "gatsby > graphql-tools@3.1.1" has incorrect peer dependency "graphql@^0.13.0".
warning "gatsby > pnp-webpack-plugin > ts-pnp@1.0.1" has unmet peer dependency "typescript@*".
warning "gatsby-source-pg > gatsby-source-graphql > apollo-link@1.2.1" has incorrect peer dependency "graphql@^0.11.3 || ^0.12.3 || ^0.13.0".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 37.83s.
但是现在,我可以使用GraphiQL
playway执行graphql查询,也可以在项目中执行
更新:
您可以最小化分辨率,只需说:
"resolutions": {
"graphql": "14.x"
}
特别感谢Postgraphile中的@benjiRun
npm列表graphql
然后,检查找到的graphql的最高版本
之后,将其添加到您的包.json
:
"resolutions":{
"graphql": "<highest found version>"
}
“决议”:{
“graphql”:”
}
然后,删除package lock.json
和node\u modules
文件夹。
运行npm安装