Skip to content
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

Cannot find module 'react-dom' from 'ReactSixteenAdapter.js' #1390

Closed
turnipdabeets opened this issue Nov 27, 2017 · 5 comments
Closed

Cannot find module 'react-dom' from 'ReactSixteenAdapter.js' #1390

turnipdabeets opened this issue Nov 27, 2017 · 5 comments

Comments

@turnipdabeets
Copy link

turnipdabeets commented Nov 27, 2017

enzyme-adapter-react-16 has a peerDependency for react-dom, however React Native apps do not have react-dom installed.

This throws an error Cannot find module 'react-dom' from 'ReactSixteenAdapter.js'. A quick fix is to install react-dom explicitly as a devDependency, but this is not an ideal solution.

@ljharb
Copy link
Member

ljharb commented Dec 1, 2017

enzyme-adapter-react-16 is for React 16; react-dom is required. If you want to use it with react-native, someone would need to create an adapter for react-native.

@thegame8714
Copy link

hi @ljharb, do you know if by any chance someone is working about this issue?

@ljharb
Copy link
Member

ljharb commented Jan 26, 2018

@thegame8714 this issue is in fact not an issue; #1436 tracks creating an adapter for react-native.

@nelsonchen90
Copy link

for my case, I linked the internal node-module which includes the enzyme. once I unlink it, the error goes away

@nikoremi97
Copy link

nikoremi97 commented May 8, 2019

in your setUp.ts file, in include this lines

import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });

Before, I just import enzyme-adapter-react-16 like this: import * as Adapter from 'enzyme-adapter-react-16, but now it gives me type error. So, I had to type configure({adapter: new Adapter.default() }); and that threw the error Cannot find module 'react-dom' from 'ReactSixteenAdapter.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants