依赖没有重命名

Jam*_*yuc 4 npm reactjs

我最近用 Gatsby 创建了一个项目。当我尝试使用 @emotion/core 和 @emotion/styled 时,它显示了一个错误。

请参阅我们关于调试 HTML 构建的文档页面以获取帮助https://gatsby.dev/debug-html 该@emotion/core包已重命名为@emotion/react. 请像这样导入import { jsx } from '@emotion/react'。

2 |

3 | throw new Error("该@emotion/core包已重命名为@emotion/react。请像这样导入import { jsx } from '@emotion/react'。"); | ^ 4 |

WebpackError:@emotion/core包已重命名为@emotion/react. 请像这样导入import { jsx } from '@emotion/react'。

  • Emotion-core.cjs.dev.js:3 node_modules/@emotion/core/dist/emotion-core.cjs.dev.js:3:1

  • 情感核心.cjs.js:6 node_modules/@emotion/core/dist/emotion-core.cjs.js:6:20

  • gatsby-ssr.js:9 node_modules/gatsby-plugin-manifest/gatsby-ssr.js:9:15enter code here

我已经将它重命名并导入,因为它在那里显示。我也尝试使用 Gatsby clean 并删除 node_modules 并再次安装,但仍然出现错误。我感谢您的帮助。

小智 12

我遇到了同样的问题并通过降级 @emotion/core 包解决了。

npm install @emotion/core@10.1.1
Run Code Online (Sandbox Code Playgroud)