Weird error when trying to use graphql

Hi, does anyone know what this error is about?

This topic has been created from a Discord post (1268211788743184414) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

This is my frontend package.json:

{
  "name": "next frontend",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "node server.js",
    "lint": "next lint"
  },
  "dependencies": {
    "@apollo/client": "^3.10.0-alpha.1",
    "@apollo/experimental-nextjs-app-support": "^0.11.2",
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.5",
    "@headlessui/react": "^2.1.2",
    "@mui/material": "^5.16.4",
    "@next/eslint-plugin-next": "^14.2.5",
    "autoprefixer": "^10.4.19",
    "axios": "^1.7.2",
    "bcryptjs": "^2.4.3",
    "better-sqlite3": "^7.4.3",
    "dotenv": "^16.4.5",
    "emailjs-com": "^3.2.0",
    "eslint": "^8.57.0",
    "eslint-config-next": "14.2.4",
    "graphql": "^16.9.0",
    "js-cookie": "^3.0.5",
    "jsonwebtoken": "^9.0.2",
    "next": "14.2.4",
    "next-auth": "^4.24.7",
    "next-connect": "^1.0.0",
    "pg": "^8.12.0",
    "pg-hstore": "^2.3.4",
    "postcss": "^8.4.39",
    "react": "^18",
    "react-dom": "^18",
    "tailwindcss": "^3.4.6"
  }
}

and this the backend:

{
  "name": "strapi backend",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi",
    "deploy": "strapi deploy"
  },
  "dependencies": {
    "@apollo/client": "^3.11.1",
    "@strapi/plugin-cloud": "^4.25.4",
    "@strapi/plugin-graphql": "^4.25.5",
    "@strapi/plugin-i18n": "^4.25.4",
    "@strapi/plugin-users-permissions": "^4.25.4",
    "@strapi/strapi": "^4.25.4",
    "better-sqlite3": "8.6.0",
    "mysql": "^2.18.1",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "5.3.4",
    "styled-components": "5.3.3"
  },
  "author": {
    "name": "Hanna Rosenfeld"
  },
  "strapi": {
    "uuid": "8e145640-7f0f-4252-b50e-ebb741ff2321"
  },
  "engines": {
    "node": ">=18.0.0 <=20.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

The error message says that you have two (versions of) graphql installed in your node-modules folder. The error message is from the back-end, so ignoring the front-end package.json, I believe that the issue is related to "@strapi/plugin-graphql": "^4.25.5". This package probably includes graphql, just as "@strapi/strapi": "^4.25.4" itself.

If removing plugin-graphql from your package.json will resolve this error message (don’t forget to remove the node_modules and package-lock before re-installing everything with npm i). I would suggest to re-install it with a package that uses the same version as @strapi/strapi. Either by upgrading @strapi/strapi, or by downgrading @strapi/plugin-graphql": "^4.25.5