Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot find module 'graphql/polyfills/objectValues'

An error message thrown to my Gatsby & Typescript app. 'gatsby develop' doesn't work due to this.

Here's my web-app dependancies, please help.!!

"dependencies": {
    "@emotion/react": "^11.4.0",
    "@emotion/styled": "^11.3.0",
    "babel-eslint": "^10.1.0",
    "gatsby": "^3.5.0",
    "gatsby-cli": "^3.5.0",
    "gatsby-plugin-emotion": "^6.5.0",
    "gatsby-plugin-image": "^1.4.0",
    "gatsby-plugin-offline": "^4.4.0",
    "gatsby-plugin-react-helmet": "^4.4.0",
    "gatsby-plugin-sharp": "^3.4.1",
    "gatsby-plugin-typescript": "^3.5.0",
    "gatsby-remark-images": "^5.2.0",
    "gatsby-remark-prismjs": "^5.2.0",
    "gatsby-source-filesystem": "^3.4.0",
    "gatsby-transformer-remark": "^4.2.0",
    "gatsby-transformer-sharp": "^3.4.0",
    "graphql": "^0.12.3",
    "graphql-tag": "^2.12.4",
    "init": "^0.1.2",
    "peer-graphql": "0.0.3",
    "prismjs": "^1.23.0",
    "prop-types": "^15.7.2",
    "react": "^17.0.1",
    "react-dom": "^17.0.1",
    "react-helmet": "^6.1.0",
    "tsc": "^2.0.3",
    "typescript": "^4.2.4"
  }
like image 989
reacttojs Avatar asked Sep 02 '26 14:09

reacttojs


2 Answers

I just ran into this same issue, and it ended up being a peer dependency issue—specifically for the graphql package. Installing version 15.x solved the issue for me.

npm install graphql@^15.0.0
like image 191
Andrew Rubin Avatar answered Sep 04 '26 22:09

Andrew Rubin


It looks like you installed graphql explicitly, however, you installed a really old version of it. My guess is that a dependency of yours installs a different version of graphql and the build process is then resolving it to your outdated one, or there's a peer dependency that you're not fulfilling, which would come up as a warning from yarn or npm (depending on which one you're using) on a fresh install.

The easiest way to resolve this would be for you upgrade to a newer version of graphql as this will just resolve the incompatibility immediately.

However, it's likely worth checking where you went wrong. Check your package manager for peer dependency warnings, use Yarn or npm's list command to find out what duplicates (if any) of the GraphQL.js package you have, and go from there.

like image 38
Phil Plückthun Avatar answered Sep 05 '26 00:09

Phil Plückthun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!