MichalLytek / typegraphql-prisma

Prisma generator to emit TypeGraphQL types and CRUD resolvers from your Prisma schema
https://prisma.typegraphql.com
MIT License
891 stars 113 forks source link

@apollo/server unable to resolve dependency tree #364

Closed raskyer closed 1 year ago

raskyer commented 1 year ago

Describe the Bug When trying to setup a new project from scratch, including all the dependencies mention in the doc, when we try to install @apollo/server we have an error with npm

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: api@1.0.0
npm ERR! Found: graphql@15.8.0
npm ERR! node_modules/graphql
npm ERR!   graphql@"^15.8.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^16.6.0" from @apollo/server@4.4.1
npm ERR! node_modules/@apollo/server
npm ERR!   @apollo/server@"*" 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.

To Reproduce Package.json

{
  "name": "api",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {},
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@prisma/client": "^4.11.0",
    "@types/graphql-fields": "^1.3.4",
    "class-validator": "^0.14.0",
    "graphql": "^15.8.0",
    "graphql-fields": "^2.0.3",
    "graphql-scalars": "^1.20.1",
    "reflect-metadata": "^0.1.13",
    "tslib": "^2.5.0",
    "type-graphql": "^1.1.1"
  },
  "devDependencies": {
    "@types/node": "^18.14.6",
    "prisma": "^4.11.0",
    "typegraphql-prisma": "^0.24.2",
    "typescript": "^4.9.5"
  }
}

ts-config

{
  "compilerOptions": {
    "rootDirs": ["src"],
    "outDir": "dist",
    "lib": ["es2018", "esnext.asynciterable"],
    "target": "es2018",
    "module": "commonjs",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "types": ["node"]
  }
}

Expected Behavior Works without issue ...

Environment (please complete the following information):

raskyer commented 1 year ago

Updating the typegraphql to version beta seems to fix the issue, but other issue comes in when there's many to many tables as refer in other tickets : Input Object type MyTypeUpdateManyMutationInput must define one or more fields.

That's unfortunate. Good luck with your project.