How To Fix “Module not found: Error: Can’t resolve ‘react/jsx-runtime’”?
Are you having problems with the issue “Module not found: Error: Can’t resolve ‘react/jsx-runtime’“? How to fix it? In today’s article, I will provide solutions for you to solve the issues. Please follow the below steps to get the problem resolved now
How did “Module not found: Error: Can’t resolve ‘react/jsx-runtime’” occur?
Module not found: Error: Can’t resolve ‘react/jsx-runtime’
When you work with ReactJS, you may get the issue Module not found: Error: Can’t resolve ‘react/jsx-runtime’. Don’t worry, we are here to provide you solutions in order to resolve your problem.
How to fix “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 then Just Change this following tsconfig: “jsx”: “react-jsx” Now, Your error must be solved. The second solution is to use this command to update react version to the most recent one: npm install –save react@latest. Now your error should be fixed.
Solution 1: React 17.
This is the tsconfig for React 17 and Typescript 4.1.0.
"jsx": "react"
Your mistake must now be fixed
Solution 2: React 17
Simply change the following tsconfig if you are using React 17
"jsx": "react-jsx"
Now, your error must be fixed.
Solution 3: Update react version
This command will update react Version to the most recent version.
npm install --save react@latest
Now, you should correct your error.
Final words
The above are useful solutions that can help you fix “Module not found: Error: Can’t resolve ‘react/jsx-runtime’” problem, if you can’t solve it well. Please leave a message.