question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find module 'react/jsx-runtime'

See original GitHub issue

Current behavior:

I’ve upgraded to v11, I received the following error when the run the test suite.

  ● Test suite failed to run

    Cannot find module 'react/jsx-runtime' from 'node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.cjs.dev.js'

    Require stack:
      node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.cjs.dev.js
      node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.cjs.js
      packages/react-ui/src/utils/test-utils.js
      jest.setup.js

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:306:11)
      at Object.<anonymous> (node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.cjs.dev.js:14:23)

My babel file:

module.exports = {
  env: {
    test: {
      presets: [
        [
          "@babel/preset-env",
          {
            targets: {
              node: "current",
            },
          },
        ],
        [
          "@babel/preset-react",
          {
            runtime: "automatic",
            importSource: "@emotion/react",
          },
        ],
      ],
      plugins: ["@emotion/babel-plugin"],
    },
  },
};

Environment information:

  • react version: 17.0.1
  • @emotion/react version: 11.0.0
  • @emotion/jest version: 11.1.0
  • @emotion/babel-plugin version: 11.0.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (2 by maintainers)

github_iconTop GitHub Comments

23reactions
cforsyth68commented, Aug 25, 2021

As of now, this fixes it for me…

yarn add @types/react

or

npm install @types/react

20reactions
mverissimocommented, Nov 18, 2020

I generated a new lock file and works fine, thanks for the help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught Error: Cannot find module 'react/jsx-runtime'
This solution resolved my issue. I found it over here. 👇️ with NPM. npm install react@latest react-dom@latest ...
Read more >
cannot find module '@emotion/react/jsx-runtime' or its ...
If you're still getting the "Cannot find module 'react/jsx-runtime' or its corresponding type declarations" error, open your package.json file and make sure ......
Read more >
jsx-runtime - npm
Runtime does not renders JSX-IR, otherwise it provides common interfaces for Renderer to be implemented. Installation. npm install jsx-runtime ...
Read more >
[Solved]-Uncaught Error: Cannot find module 'react/jsx-runtime'
[Solved]-Uncaught Error: Cannot find module 'react/jsx-runtime'-Reactjs ... So my setup actually was working. There was somehow a glitch in the symlink. I as...
Read more >
react-dnd 16.0.0 and DnDProvider.js : r/reactjs - Reddit
ERROR in ./node_modules/react-dnd/dist/core/DndProvider.js 39:0-48 Module not found: Error: Can't resolve 'react/jsx-runtime' in 'C:\mcdev\react ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found