简体   繁体   English

SignUp突变的Prisma graphql错误

[英]Prisma graphql error on signUp mutation

I tried to do a signup mutation in the playground but I am getting an error which I cannot understand, tried a lot of ways to fix it like adding an authorisation header by getting a token from prisma token also, quite stuck.. 我试图在操场上进行注册突变,但遇到一个我无法理解的错误,尝试了多种方法来修复它,例如也通过从prisma令牌中获取令牌来添加授权标头,这很困难。

在此处输入图片说明

That error occurs if you have two different versions of graphql in your entire dependency tree. 如果整个依赖关系树中有两个不同版本的graphql ,则会发生该错误。

Your dependencies and dev dependencies for package.json need to use the same version of graphql , and all those dependencies need to have graphql as their peer dependency, like this: package.json依赖项和dev依赖项需要使用相同版本的graphql ,所有这些依赖项都必须具有graphql作为其对等依赖项,如下所示:

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

Note that in your own package.json , you don't need the peer dependency. 请注意,在您自己的package.json ,您不需要对等项依赖。 Here's an example of dependencies in your package.json that fulfill the requirements I mentioned above: 这是您package.json中满足我上面提到的要求的依赖项的一个示例:

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

I copied the dependencies from here . 我从这里复制了依赖项。

Update your package.json to the above dependencies , then rm -rf node_modules yarn.lock and npm install or yarn . package.json更新为上述依赖项,然后rm -rf node_modules yarn.locknpm installyarn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM