Open laradevitt opened 4 years ago
I am also getting this issue.
From my package.json
"dependencies": {
"babel-plugin-styled-components": "^1.10.7",
"gatsby": "^2.19.25",
"gatsby-background-image": "^1.0.1",
"gatsby-cli": "^2.11.5",
"gatsby-image": "^2.3.1",
"gatsby-plugin-google-analytics": "^2.2.2",
"gatsby-plugin-manifest": "^2.3.3",
"gatsby-plugin-netlify": "^2.2.1",
"gatsby-plugin-offline": "^3.1.2",
"gatsby-plugin-react-helmet": "^3.2.1",
"gatsby-plugin-sass": "^2.2.1",
"gatsby-plugin-sharp": "^2.5.4",
"gatsby-plugin-sitemap": "^2.3.1",
"gatsby-plugin-styled-components": "^3.2.1",
"gatsby-source-filesystem": "^2.2.2",
"gatsby-source-graphql": "^2.3.1",
"gatsby-source-prismic-graphql": "^3.4.0-beta.2",
"gatsby-transformer-sharp": "^2.4.4",
"intersection-observer": "^0.7.0",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
"outdated": "^0.1.1",
"prismic-reactjs": "^1.3.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-helmet": "^5.2.1",
"react-intersection-observer": "^8.25.2",
"react-spring": "^8.0.27",
"styled-components": "^5.0.1"
},
Did you try the workaround?
@laradevitt Sorry, I forgot to mention that. Yes, used workaround and fixed the issue.
I've also realised you've put this issue under the gatsby-source-graphql-universal
repo, not under gatsby-source-prismic-graphql
. Should this be moved?
@lqze
Yes, used workaround and fixed the issue.
Ah, glad that worked for you.
Should this be moved?
I can see how it might be confusing but indeed this is the correct project. The problematic dependency on graphql
lies with gatsby-source-graphql-universal
(this project), which is a dependency of gatsby-source-prismic-graphql
.
The same issue happens when using PNPM.
I assume this is because of the multiple versions of graphql that are potentially stored in the global node_modules folder.
The workaround didn't solve the issue, same as before. Reverting back to npm for now.
@elias-thok Hi there. You need to delete node_modules/ and yarn.lock and install again. I'll note that in the main post. And yes, it doesn't seem to be exclusive to this module.
@laradevitt Since I was using PNPM there is no yarn.lock but a pnpm-lock.json.
Unfortunately deleting node_modules & pnpm-lock.json did not solve the issue. I suspect this is because PNPM uses symlinks to a shared node_modules directory where, by design, there will possibly be several graphql packages from other projects.
But npm is fine for now :-)
@elias-thok - Of course that makes sense. Sorry, not familiar with pnpm!
Just want to add a note on how I solved this issue. I did the workaround but it did not work until I also ran npm dedupe. Does this make sense?
Problem
I'm not sure how this came up, I started getting the error below on my projects that depend on gatsby-source-prismic-graphql.
This indicates multiple versions of graphql which is obviously not allowed.
A couple of other issues posted in the last few days:
https://github.com/birkir/gatsby-source-prismic-graphql/issues/176 https://github.com/gatsbyjs/gatsby/issues/22645
Output of
yarn why graphql
:Looking at the source for the latest version of this package (3.1.11) in node_modules/ (which, weirdly, doesn't appear to be in sync with this repo), the given version for graphql is "*" which seems wrong?
Workaround
My workaround is to delete node_modules/ and yarn.lock, then add a resolution to package.json in the project root (or workspaces root if that is your set-up):
Then reinstall with
yarn
.Thanks -
Edit: Expanding on workaround.