Why does Apollo Client download:schema fail with "Error: Cannot find module 'graphql/validation/rules/UniqueTypeNames'"

Why does Apollo Client download:schema fail with "Error: Cannot find module 'graphql/validation/rules/UniqueTypeNames'"

我正在尝试使用命令下载 graphql 模式

apollo client:download-schema --endpoint=https://my-endpoint --header='x-hasura-admin-key: <my key>'

我得到一个错误:Error: Cannot find module 'graphql/validation/rules/UniqueTypeNames'

我在 package.json

中有以下依赖项和开发依赖项
  "dependencies": {
    "@apollo/client": "^3.4.16",
    "@vue/apollo-composable": "^4.0.0-alpha.15",
    "core-js": "^3.6.5",
    "graphql": "^16.0.0",
    "graphql-tag": "^2.12.5",
    "vue": "^3.2.20",
    "vue-auth0-plugin": "^2.4.1",
    "vue-router": "^4.0.0-0"
  },
  "devDependencies": {
    "@typescript-eslint/eslint-plugin": "^4.18.0",
    "@typescript-eslint/parser": "^4.18.0",
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "~4.5.0",
    "@vue/cli-plugin-typescript": "~4.5.0",
    "@vue/cli-service": "~4.5.0",
    "@vue/compiler-sfc": "^3.0.0",
    "@vue/eslint-config-typescript": "^7.0.0",
    "apollo": "^2.33.7",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^7.0.0",
    "typescript": "~4.1.5"
  }

我刚刚删除了 package-lock.json 并重新运行 npm install 但仍然出现相同的错误。

我是否需要手动调整 apollo 或 graphql 的版本,如果需要,调整到什么? 或者有没有其他方法可以解决这个问题。

提前致谢。

在 package.json 中将 graphql 设置为 v15.7.2。这可行,但还需要删除 node_modules 目录,删除 package-lock.json 文件并重新运行 npm install 以消除与多个 graphql 库版本

的一些冲突