Incompatible versions of GraphQL and TypegraphQL

Viewed 1484
Error: Looks like you use an incorrect version of the 'graphql' package: "16.0.1". Please ensure that you have installed a 
version that meets TypeGraphQL's requirement: "^15.3.0".

Why? 16 > 15? I was just following a tutorial from 2 years ago. I think, I am gonna downgrade to older versions.

package.json

{
  "name": "server",
  "version": "0.0.1",
  "description": "Awesome project developed with TypeORM.",
  "devDependencies": {
    "@types/express": "^4.17.13",
    "@types/graphql": "^14.5.0",
    "@types/node": "^16.11.7",
    "ts-node": "10.4.0",
    "typescript": "4.4.4",
    "ts-node-dev": "1.1.8"
  },
  "dependencies": {
    "apollo-server-express": "^3.5.0",
    "express": "^4.17.1",
    "graphql": "16.0.1",
    "pg": "^8.4.0",
    "reflect-metadata": "^0.1.10",
    "type-graphql": "1.1.1",
    "typeorm": "0.2.40"
  },
  "scripts": {
    "start": "ts-node-dev --respawn src/index.ts",
    "typeorm": "node --require ts-node/register ./node_modules/typeorm/cli.js"
  }
}
1 Answers

Currently type-graphql supports only graphql with major version 15 and minor version above (or equal) to 5.

^15.5.0: you can include everything that does not increment the first non-zero portion of semver.

For more information see https://semver.npmjs.com

The latests 15th major version of graphql is 15.7.2.

Therefore you have to do the following for everything to work:

  1. Uninstall graphql
npm uninstall graphql
  1. Install graphql version 15.7.2
npm install graphql@15.7.2

Now everything should work as expected.

Related