5

I cannot seem to resolve why I'm receiving this error: Here are my configs:

lang-js
react - 15.3.1
react-dom - 15.3.1
react-testing-library - 6.0.0
jest - 23.6.0

lang-js
import React from 'react';
import { render, fireEvent, cleanup } from 'react-testing-library';

afterEach(cleanup);

test('loads and displays ', async() => {

})

I commented on an open GH issue on the react-testing-library page. Thanks in advance

2
  • Are you using npm or yarn? Commented Mar 15, 2019 at 1:28
  • (1) Could you post your package.json file (because it seems important according to your answer). (2) Could you post your solution as answer instead of a comment? Commented Jul 13, 2023 at 2:51

1 Answer 1

2

This may have happened if something got modified or deleted in your react-dom dependency package.

Using yarn

You can verify that already installed files in node_modules did not get removed, reinstalling any missing files by using:

npm install --check-files

That should help you restore react-dom to what it should be.

If that doesn't work, you can always try to completely remove and reinstall all of your packages. From your project root folder, try:

rm -rf node_modules
yarn install

Using npm

First, you can try just to install react-dom again. That might solve your problem:

npm install react-dom

If that doesn't work, then you can try to reinstall all of your packages to get a fresh copy.

From your project root folder, try:

rm -rf node_modules
npm install
Sign up to request clarification or add additional context in comments.

2 Comments

I removed my node_modules folder, and that didnt fix it. The fix was to add ^ to my react dependencies: react - ^15.3.1, react-dom - ^15.3.1
@eagercoder I'm glad you found a workable solution to your issue! Happy coding!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.