-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With a new version 12.1.5 of "@testing-library/react" running "npx create-react-app" fails with an ERESOLVE issue #12278
Comments
I came across this problem, too! |
Why you closed this? @stas-litv Did you solve this problem? |
Closed the issue because the problem was in npm cache of my computer. |
How did you fix the issue? I have the same problem. Thanks in advance. |
Sorry, didn't check everything. The problem is still active for me. I'm reopening it. |
Ah okay, so we just need to wait for an update? |
Looks like we need to wait, I don't know for sure. That's why I reopened the issue. Pull request that fixes it: #12223 |
I'm also experiencing this issue. |
This is happening to me too. |
Same issue here |
CRA 5.0.0 was released many months ago. I wonder why they did not notice this many months ago? |
The problem has appeared just 6-7 hours ago when version 12.1.5 of @testing-library/react was released |
Currently experiencing the same issue. MacOS 12.3.1 |
is there a workaround for this? |
OK. After digging, I found this: testing-library/react-testing-library PR#1041, So here's the timeline:
|
So, I found a temporary solution. You can use Custom Template for creating React App with CRA instead of default cra-template package (https://www.npmjs.com/package/cra-template). Using of Custom Templates is well described in https://create-react-app.dev/docs/custom-templates/ All you want for this solution is to change version or RTL (React Testing Library) in the template.json file of your custom template to Step-by-step:
It worked well for me EDIT: fixed a typo "cra-install" to "cra-template" Thanks! |
Thanks for the solution! Just a note, that there is a typo in case anyone is confused. It should be "npm install cra-template" |
Temporary workaround: npx create-react-app my-app (let the build fail)
Delete reportWebVitals.js Re-install with npm install. |
@stas-litv is this closed because it has been resolved? |
It will be resolved in the next version on CRA, there's already accepted pull request for it (mentioned before). |
@stas-litv I see - thank you! |
hola , en un grupo de facebook un usuario me compartio esta solucion: import React from 'react'; ); luego puedes ejecutar npm start sin problemas |
Hi, may i know what do you re-install with npm install? Thank you so much. |
I found the solution. create-react-app is not updating index.js as per the new react V18 so you need to modify index.js file as follow import React from 'react'; const container = document.getElementById('root'); root.render( // If you want to start measuring performance in your app, pass a function |
Workaround
Edit |
+1 for @mwskwong here, worked well. Also in case anyone's just looking to get a project running in the interim, |
I also have this issue. Has it officially been fixed yet or do I need to use the workaround solution for now? What are the pros and cons, should I wait for the official fix? |
Another work around, that allows me to go ahead with React 18 and the TypeScript CRA template:
|
running |
Using From my understanding they pretty much do the same thing except version control. Compare npx and npm: |
Thank you for fixing the issue. I thought something was with my computer, so I tried on Windows, Linux and Mac all with the same issue. Today everything worked great. Thank you for your work. A deep bow from me! |
Describe the bug
If you run "npx create-react-app Project-Name" after version 12.1.5 of @testing-library/react was released if will fail because current "cra-template" has "@testing-library/react": "^12.0.0" in its dependencies template for a new project. Version 12.1.5 of @testing-library/react requires "react": "<18.0.0" in its peer dependencies. That creates a conflict of dependencies.
Error report:
While resolving: [email protected]
Found: [email protected]
node_modules/react
react@"^18.0.0" from the root project
Could not resolve dependency:
peer react@"<18.0.0" from @testing-library/[email protected]
node_modules/@testing-library/react
@testing-library/react@"^12.0.0" from the root project
Raw JSON explanation object:
{
"code": "ERESOLVE",
"current": {
"name": "react",
"version": "18.0.0",
"whileInstalling": {
"name": "test2",
"version": "0.1.0",
"path": """
},
"location": "node_modules/react",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "react",
"spec": "^18.0.0",
"from": {
"location": """
}
}
]
},
"currentEdge": {
"type": "prod",
"name": "react",
"spec": "^18.0.0",
"from": {
"location": """
}
},
"edge": {
"type": "peer",
"name": "react",
"spec": "<18.0.0",
"error": "INVALID",
"from": {
"name": "@testing-library/react",
"version": "12.1.5",
"whileInstalling": {
"name": "test2",
"version": "0.1.0",
"path": """
},
"location": "node_modules/@testing-library/react",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "@testing-library/react",
"spec": "^12.0.0",
"from": {
"location": "*********************************"
}
}
]
}
},
"strictPeerDeps": false,
"force": false
}
The text was updated successfully, but these errors were encountered: