如何解决无法使用GraphQLNonNull“ [用户]!”来自另一个模块或领域
我知道这个问题被问了很多,但是现有的答案并没有帮助我。每当我尝试启动服务器时,都会出现此错误:
[nodemon] 2.0.4
[nodemon] to restart at any time,enter `rs`
[nodemon] watching path(s): *.*
[nodemon] watching extensions: js,graphql
[nodemon] starting `babel-node src/index.js`
The server is up!
Error: Cannot use GraphQLNonNull "[User]!" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules,use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at instanceOf (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/node_modules/graphql/jsutils/instanceOf.js:28:13)
at isNonNullType (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/node_modules/graphql/type/definition.js:194:34)
at isWrappingType (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/node_modules/graphql/type/definition.js:364:30)
at Object.getNamedType (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/node_modules/graphql/type/definition.js:423:12)
at buildInfoFromFragment (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/src/info.ts:105:21)
at Object.buildInfo (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/src/info.ts:36:12)
at Prisma.Delegate.delegateToSchema (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/src/Delegate.ts:159:18)
at Prisma.<anonymous> (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/src/Delegate.ts:65:17)
at step (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/dist/Delegate.js:32:23)
at Object.next (/Users/yildirim/Desktop/backend/node_modules/graphql-binding/dist/Delegate.js:13:53)
将“分辨率”写入“ package.json”文件也无济于事。因此,这听起来像是版本冲突问题。
这是我的package.json文件:
{
"name": "backend","version": "1.0.0","description": "","main": "index.js","scripts": {
"start": "nodemon src/index.js --ext js,graphql --exec babel-node","test": "echo \"Error: no test specified\" && exit 1","get-schema": "graphql-codegen --config codegen.yml"
},"keywords": [],"author": "","license": "ISC","devDependencies": {
"@graphql-codegen/cli": "1.17.8","nodemon": "^2.0.4","@graphql-codegen/typescript-document-nodes": "1.17.8","@graphql-codegen/introspection": "1.17.8"
},"dependencies": {
"@graphql-codegen/schema-ast": "^1.17.8","babel-cli": "^6.26.0","babel-plugin-transform-object-rest-spread": "^6.26.0","babel-preset-env": "^1.7.0","core-util-is": "^1.0.2","graphql-cli": "^4.0.0","graphql-tools": "^6.2.3","graphql-yoga": "^1.18.3","prisma-binding": "^2.3.16","uuid": "^8.3.0"
}
}
我真的不知道该如何继续。 谁能帮我?提前致谢! :)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。