Search code examples
react-nativeunit-testingreact-native-testing-library

Why can't I install the React Native Testing library?


I'm new to app testing and have started delving into this topic since yesterday. I wanted to write tests for my React Native app and tried to install React Native Testing Library with this command:

npm install --save-dev @testing-library/react-native @testing-library/jest-native

Then I ran into the following problem:

enter image description here

I tried to find a solution to this problem in Google, but I did not succeed. As far as I understand, the problem lies in the dependencies? Please tell me what can I do in this case?

P.S. I tried to create a completely clean project with expo init, tried to install the library but got exactly the same error


Solution

  • Hit the same issue and didn't want to update everything at the moment so I solved the issue by running a suggestion on the npm error output:

    npm install --save-dev @testing-library/react-native --legacy-peer-deps

    It worked for me