javascript - 注册突变时出现 Prisma graphql 错误

标签 javascript graphql prisma

我试图在 playground 中进行注册突变,但我遇到了一个我无法理解的错误,尝试了很多方法来修复它,比如通过从 prisma token 获取 token 来添加授权 header ,非常卡住..

enter image description here

最佳答案

如果您的整个依赖关系树中有两个不同版本的 graphql,则会发生该错误。

package.json 的依赖项和开发依赖项需要使用相同版本的 graphql,并且所有这些依赖项都需要有 graphql作为他们的同伴依赖,像这样:

  "peerDependencies": {
    "graphql": "^0.11.0 || ^0.12.0 || ^0.13.0"
  }

请注意,在您自己的 package.json 中,您不需要对等依赖项。以下是满足我上面提到的要求的 package.json 中的依赖项示例:

  "dependencies": {
    "graphql-yoga": "1.4.3",
    "prisma-binding": "1.5.16"
  },
  "devDependencies": {
    "graphql-cli": "2.15.8",
    "prisma": "1.3.3"
  }

我从 here 复制了依赖项.

将您的 package.json 更新为上述依赖项,然后 rm -rf node_modules yarn.locknpm installyarn

关于javascript - 注册突变时出现 Prisma graphql 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48769019/

相关文章:

graphql - 使用 Prisma 查询 NOT NULL GraphQL

typescript - Prisma + Nest JS,我应该使用什么 Promise 类型?

graphql - Apollo graphql : makeExecutableSchema & playground

javascript - 如何将图像附加到本地存储?

graphql - 如何从 GraphQL 模式生成 Kotlin 和/或 Java 数据模型

javascript - 使用 ng-template 清空 native 元素

node.js - 无法在 graphQL 中使用 populate 获取嵌套 Mongoose 查询

java - GraphQLTester with SpringBoot Failed to instantiate xxx specified class is 一个接口(interface)

javascript - 我怎么误用了 ||这段代码中的逻辑运算符?

javascript - three.js - 单击平面内的 X Y 位置