strapi icon indicating copy to clipboard operation
strapi copied to clipboard

Cannot install Plugins "@strapi/plugin-graphql"

Open anthoai97 opened this issue 3 years ago • 0 comments

Bug report

Required System information

  • Node.js version: v16.15.0
  • NPM version: 8.5.5
  • Strapi version: "4.3.2"
  • Database:
  • Operating system:

Steps to reproduce the behavior

Cannot run project after install Graphql Plugin. Error return: [2022-08-10 12:58:07.468] debug: ⛔️ Server wasn't able to start properly. [2022-08-10 12:58:07.469] error: merge.extractExtensionsFromSchema is not a function

Screenshots

Screen Shot 2022-08-10 at 13 03 59

anthoai97 avatar Aug 10 '22 06:08 anthoai97

Same for me when migrating to strapi "4.3.2"

Capture d’écran 2022-08-10 à 09 03 11

LabatJordan avatar Aug 10 '22 07:08 LabatJordan

+1

SujayPrabhu96 avatar Aug 10 '22 07:08 SujayPrabhu96

Same error here.

It is because of the latest change in @graphql-tools/merge accroding to ardatan/graphql-tools#4625

extractExtensionsFromSchema moved from @graphql-tools/merge to @graphql-tools/schema.

MikuZZZ avatar Aug 10 '22 07:08 MikuZZZ

+1

Sunny-Pirate avatar Aug 10 '22 07:08 Sunny-Pirate

Add the resolution filed to lock @graphql-tools/merge package version to 8.3.0 can solve this problem temporarily.

"resolutions": {
    "**/@graphql-tools/merge": "8.3.0"
  },

MikuZZZ avatar Aug 10 '22 07:08 MikuZZZ

Add the resolution filed to lock @graphql-tools/merge package version to 8.3.0 can solve this problem temporarily.

"resolutions": {
    "**/@graphql-tools/merge": "8.3.0"
  },

It work !!! Thank you @MikuZZZ

anthoai97 avatar Aug 10 '22 08:08 anthoai97

Add the resolution filed to lock @graphql-tools/merge package version to 8.3.0 can solve this problem temporarily.

"resolutions": {
    "**/@graphql-tools/merge": "8.3.0"
  },

Same here. Thank you so much for this temporary fix!

plcdnl avatar Aug 10 '22 08:08 plcdnl

If you are using npm you can add the following to your package.json until its fixed:

...
  "overrides": {
    "@graphql-tools/merge": "8.3.0"
  },
...

JanKoll avatar Aug 10 '22 09:08 JanKoll

Add the resolution filed to lock @graphql-tools/merge package version to 8.3.0 can solve this problem temporarily.

"resolutions": {
    "**/@graphql-tools/merge": "8.3.0"
  },

I followed the setup for deploying strapi using heroku with graphql plugin, running it locally works fine, but after deploying it to heroku, the issue still exist. adding "resolutions" code above works for yarn and adding "overrides" works for npm, basically heroku uses npm. hope this helps.

bouncydragon avatar Aug 10 '22 10:08 bouncydragon

I'm still getting this on Strapi 4.2.3. I've tried applying both resolutions and overrides, and for completeness added @graphql-tools/schema to the overrides, but I still get the issue. Any suggestions?

  "dependencies": {
    "@mattie-bundle/strapi-plugin-search": "1.0.0-alpha.3",
    "@mattie-bundle/strapi-provider-search-algolia": "1.0.0-alpha.3",
    "@strapi/plugin-graphql": "4.2.3",
    "@strapi/plugin-i18n": "4.2.3",
    "@strapi/plugin-users-permissions": "4.2.3",
    "@strapi/provider-upload-cloudinary": "4.2.3",
    "@strapi/strapi": "4.2.3",
    "bullmq": "^1.86.5",
    "node-bigcommerce": "^4.1.0",
    "pg": "^8.7.3",
    "sqlite3": "^5.0.5",
    "strapi-plugin-preview-button": "^0.3.4"
  },
  "devDependencies": {
    "@types/node": "16",
    "babel-eslint": "^10.1.0"
  },
  "resolutions": {
    "**/@graphql-tools/merge": "8.3.0",
    "**/@graphql-tools/schema": "8.3.0"
  },
  "overrides": {
    "@graphql-tools/merge": "8.3.0",
    "@graphql-tools/schema": "8.3.0"
  }

richardweaver avatar Aug 10 '22 12:08 richardweaver

Same error here. I've tried installing it on both v4.2.2 and v4.3.2.

sinamoradi1375 avatar Aug 10 '22 12:08 sinamoradi1375

I'm still getting this on Strapi 4.2.3. I've tried applying both resolutions and overrides, and for completeness added @graphql-tools/schema to the overrides, but I still get the issue. Any suggestions?

  "dependencies": {
    "@mattie-bundle/strapi-plugin-search": "1.0.0-alpha.3",
    "@mattie-bundle/strapi-provider-search-algolia": "1.0.0-alpha.3",
    "@strapi/plugin-graphql": "4.2.3",
    "@strapi/plugin-i18n": "4.2.3",
    "@strapi/plugin-users-permissions": "4.2.3",
    "@strapi/provider-upload-cloudinary": "4.2.3",
    "@strapi/strapi": "4.2.3",
    "bullmq": "^1.86.5",
    "node-bigcommerce": "^4.1.0",
    "pg": "^8.7.3",
    "sqlite3": "^5.0.5",
    "strapi-plugin-preview-button": "^0.3.4"
  },
  "devDependencies": {
    "@types/node": "16",
    "babel-eslint": "^10.1.0"
  },
  "resolutions": {
    "**/@graphql-tools/merge": "8.3.0",
    "**/@graphql-tools/schema": "8.3.0"
  },
  "overrides": {
    "@graphql-tools/merge": "8.3.0",
    "@graphql-tools/schema": "8.3.0"
  }

Which version of node are you using ? With v14 i had the same problem but not with v16

plcdnl avatar Aug 10 '22 12:08 plcdnl

+1

pepijn-vanvlaanderen avatar Aug 10 '22 12:08 pepijn-vanvlaanderen

I've resolved this, for anyone searching: if you are using yarn workspaces with hoisting your resolutions declaration needs to be in your root package.json.

richardweaver avatar Aug 10 '22 14:08 richardweaver

Marking as confirmed due to volume of confirmations.

derrickmehaffy avatar Aug 10 '22 14:08 derrickmehaffy

Just as an update to this issue, we are currently deploying an experimental release to check the fix above works and once we confirm that we will release a hotfix.

derrickmehaffy avatar Aug 10 '22 15:08 derrickmehaffy

Could I have a few of you do us a favor and test using the experimental tag:

npx create-strapi-app@experimental testHotfix --quickstart --no-run (don't forget to install the graphql plugin) Or you can move your package versions to: 0.0.0-8581854cb3

{
  "name": "test-hotfix",
  "private": true,
  "version": "0.1.0",
  "description": "A Strapi application",
  "scripts": {
    "develop": "strapi develop",
    "start": "strapi start",
    "build": "strapi build",
    "strapi": "strapi"
  },
  "devDependencies": {},
  "dependencies": {
    "@strapi/plugin-graphql": "^0.0.0-8581854cb3",
    "@strapi/plugin-i18n": "0.0.0-8581854cb3",
    "@strapi/plugin-users-permissions": "0.0.0-8581854cb3",
    "@strapi/strapi": "0.0.0-8581854cb3",
    "better-sqlite3": "7.4.6"
  },
  "author": {
    "name": "A Strapi developer"
  },
  "strapi": {
    "uuid": "e6de134e-c98c-4ac8-a9fd-3ec53af2bfed"
  },
  "engines": {
    "node": ">=12.x.x <=16.x.x",
    "npm": ">=6.0.0"
  },
  "license": "MIT"
}

derrickmehaffy avatar Aug 10 '22 15:08 derrickmehaffy

Works for me!

plcdnl avatar Aug 10 '22 15:08 plcdnl

Works for me!

Can you confirm your node-version as we noticed that some users on node 16 still get the same error

derrickmehaffy avatar Aug 10 '22 16:08 derrickmehaffy

Works for me!

Can you confirm your node-version as we noticed that some users on node 16 still get the same error

Tried on v14 and v16. Works on both for me

plcdnl avatar Aug 10 '22 16:08 plcdnl

looks good to me as well 👍

Screenshot 2022-08-10 at 18 10 18

Edit:

Though on another env (docker) I had to use --force to install due to this:

#0 22.47 npm ERR! code ERESOLVE
#0 22.48 npm ERR! ERESOLVE could not resolve
#0 22.48 npm ERR! 
#0 22.48 npm ERR! While resolving: @strapi/[email protected]
#0 22.49 npm ERR! Found: @strapi/[email protected]
#0 22.49 npm ERR! node_modules/@strapi/strapi
#0 22.49 npm ERR!   @strapi/strapi@"0.0.0-8581854cb3" from the root project
#0 22.49 npm ERR! 
#0 22.49 npm ERR! Could not resolve dependency:
#0 22.49 npm ERR! peer @strapi/strapi@"^4.0.0" from @strapi/[email protected]
#0 22.49 npm ERR! node_modules/@strapi/plugin-graphql
#0 22.49 npm ERR!   @strapi/plugin-graphql@"0.0.0-8581854cb3" from the root project
#0 22.49 npm ERR! 
#0 22.49 npm ERR! Conflicting peer dependency: @strapi/[email protected]
#0 22.49 npm ERR! node_modules/@strapi/strapi
#0 22.49 npm ERR!   peer @strapi/strapi@"^4.0.0" from @strapi/[email protected]
#0 22.49 npm ERR!   node_modules/@strapi/plugin-graphql
#0 22.49 npm ERR!     @strapi/plugin-graphql@"0.0.0-8581854cb3" from the root project
#0 22.49 npm ERR! 
#0 22.49 npm ERR! Fix the upstream dependency conflict, or retry
#0 22.49 npm ERR! this command with --force, or --legacy-peer-deps
#0 22.49 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
#0 22.49 npm ERR! 
#0 22.49 npm ERR! See /root/.npm/eresolve-report.txt for a full report.
#0 22.50 
#0 22.50 npm ERR! A complete log of this run can be found in:
#0 22.50 npm ERR!     /root/.npm/_logs/2022-08-10T16_27_22_833Z-debug-0.log

manuel-schoebel avatar Aug 10 '22 16:08 manuel-schoebel

It looks like we have determined this isn't an issue that was caused by a change we made but we think there is some other work arounds.

derrickmehaffy avatar Aug 10 '22 16:08 derrickmehaffy

This problem has been fixed on @graphql-tools repo. Thank you to ardatan for the quick fix :)

alexandrebodin avatar Aug 10 '22 17:08 alexandrebodin

To fix, just make sure you delete your package-lock.json and/or yarn.lock and reinstall node_modules, no Strapi version upgrade needed.

TY everyone for reporting this!

derrickmehaffy avatar Aug 10 '22 17:08 derrickmehaffy