[Solved] Module not found: Error: Can’t resolve ‘react/jsx-runtime’

Hello readers, Today In this article I am going to show you how to Solve – Module not found: Error: Can’t resolve ‘react/jsx-runtime’ error in ReactJs. So here I will explain all the possible solutions.

Without wasting your time, Let’s start This Article to Solve This Error.

How Module not found: Error: Can’t resolve ‘react/jsx-runtime’ Error Occurs?

This is a common error in Reactjs. When I am trying to create a shared component using a storybook with react-redux, but I got the following error. It looks as like below:

ERROR in ./node_modules/story1/build/index.es.js
Module not found: Error: Can't resolve 'react/jsx-runtime' in '/Users/gowthamv/Documents/Workspace/my-app/node_modules/story1/build'

So here are all the possible solutions that I tried to fix this error.

How To Solve Module not found: Error: Can’t resolve ‘react/jsx-runtime’ Error?

  • How To Solve Module not found: Error: Can’t resolve ‘react/jsx-runtime’ Error?

To Solve Module not found: Error: Can’t resolve ‘react/jsx-runtime’ Error If You are using React 17 then Just you have to Change this following tsconfig: “jsx”: “react-jsx” Now, Your error will be gone. The second solution is You Just need to update react Version to the latest one using this command: npm install –save [email protected] Now, Your error should be solved.

  • Module not found: Error: Can’t resolve ‘react/jsx-runtime’

To Solve Module not found: Error: Can’t resolve ‘react/jsx-runtime’ Error If You are using React < 17 & Typescript < 4.1.0 then Just Change this following tsconfig: “jsx”: “react” Now, Your error must be solved. Second solution is If You are using React 17 then Just Change this following tsconfig: “jsx”: “react-jsx” Now, Your error will be gone.

Solution 1: For React < 17

If You are using React < 17 & Typescript < 4.1.0 then Just Change this following tsconfig.

"jsx": "react"

Now, Your error must be solved.

Solution 2: For React 17

If You are using React 17 then Just Change this following tsconfig.

"jsx": "react-jsx"

Now, Your error must be solved.

Solution 3: update react version 

You need to update react Version to the latest one using this command.

npm install --save [email protected]

Now, Your error should be solved.

Conclusion

In this article, we have discussed what causes the error and we have discussed ways to fix the error.

we hope this article has been informative. Thank you for reading. Kindly comment and let us know if you found it helpful.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Categories