简体   繁体   中英

React Updated For 16.0 Failing Test Cases

I updated the react version with 16.0.0 and enzyme with 2.8.6 but still getting error can't find module react/lib/React .

How to fix these issues

Configuring Mocha... Warning: ReactTestUtils has been moved to react-dom/test-utils. Update references to remove this warning. module.js:471 throw err;

Error: Cannot find module 'react/lib/React'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

React 16 removed the ability to access React's internals through react/lib/.. . Doing so has always been frowned upon, but it became a hard error in the latest version.

If your code is relying on importing from that directory, you'll need to fix it. If one of your dependencies is relying on it, then they'll need to fix it. Based on David Tryon's comment, it sounds like you need to update Enzyme to v3 in this case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM