typescript - 错误 : Cannot find module 'graphql/polyfills/objectValues'

标签 typescript graphql gatsby

向我的 Gatsby 和 Typescript 应用程序抛出错误消息。 “gatsby develop”因此无法正常工作。

这是我的网络应用依赖项,请帮忙。!!

"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"
  }

最佳答案

我刚刚遇到了同样的问题,它最终成为一个对等依赖问题——特别是对于 graphql 包。安装 15.x 版为我解决了这个问题。

npm install graphql@^15.0.0

关于typescript - 错误 : Cannot find module 'graphql/polyfills/objectValues' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67527452/

相关文章:

angular - Typescript - 空数组引用

angular - 如何在 Angular2 中使用 Observable 通过 id 查找数组元素

typescript - 如何修复此 typescript 和 graphql 错误?

rest - GraphQL 比 REST 好在哪里?

html - 在 react html5 应用程序中,如何并排放置 3 个选择列表?

python - 如何在单个虚拟主机上服务 django 和 gatsby?

Angular 2/4/5 在 IE11 中不起作用

angular - TypeScript 找不到模块错误

laravel - 使用 Laravel Lighthouse 的 Laravel 7 中的 CORS 错误

node.js - Gatsby 的环境变量 "env.cmd not found"