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/lib/ReactComponentTreeHook' #1

Open
META-DREAMER opened this issue Mar 28, 2017 · 8 comments
Open

Cannot find module 'react/lib/ReactComponentTreeHook' #1

META-DREAMER opened this issue Mar 28, 2017 · 8 comments
Assignees

Comments

@META-DREAMER
Copy link

Trying to use this in my react native project, get the following error:

> mocha --compilers js:mocha-react-native/init --recursive src/**/__tests__/*.test.js

module.js:472
    throw err;
    ^

Error: Cannot find module 'react/lib/ReactComponentTreeHook'
    at Function.Module._resolveFilename (module.js:470:15)
    at Module._load (module.js:418:25)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/node_modules/react-dom/lib/ReactDebugTool.js:16:30)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.extensions.(anonymous function) [as .js] (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/register.js:33:14)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Module._load (module.js:439:3)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/node_modules/react-dom/lib/ReactPerf.js:18:22)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.extensions.(anonymous function) [as .js] (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/register.js:33:14)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Module._load (module.js:439:3)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/node_modules/react-addons-perf/index.js:1:80)
    at Module._compile (module.js:571:32)
    at Module._extensions..js (module.js:580:10)
    at Object.extensions.(anonymous function) [as .js] (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/register.js:33:14)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Module._load (module.js:439:3)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/node_modules/react-native-mock/build/react-native.js:111:6)
    at Module._compile (module.js:571:32)
    at Object.extensions.(anonymous function) [as .js] (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/register.js:43:17)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Module._load (module.js:439:3)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/node_modules/react-native-mock/mock.js:1:85)
    at Module._compile (module.js:571:32)
    at Object.extensions.(anonymous function) [as .js] (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/register.js:43:17)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Module._load (module.js:439:3)
    at Function.Module._load (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/lib/moduleIntercept.js:64:27)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha-react-native/init.js:7:1)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at /Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha/bin/_mocha:303:3
    at Array.forEach (native)
    at Object.<anonymous> (/Users/hammadjutt/Dev/Covet/NeloNative/node_modules/mocha/bin/_mocha:297:19)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3
@danielsukmana
Copy link

Hi @HammadJ. I can't reproduce the error on a fresh project. You can try this first:

  • delete the node_modules folder & reinstall modules: rm -rf node_modules && npm install
  • clear watchman: watchman watch-del-all
  • reset packager cache: node_modules/react-native/packager/packager.sh --reset-cache

If that doesn't solve it, can you post the list of modules that you use from the package.json file?

@panpan-lin
Copy link

Could be related to this? facebook/react-native#13390

@sibelius
Copy link

"react-test-renderer": "16.0.0-alpha.12", solved my problem

@pricetula
Copy link

i have "react-test-renderer": "16.0.0-alpha.12", in my project it still persists

@gabceb
Copy link

gabceb commented Nov 10, 2017

This issue actually comes from a dep currently talked about at RealOrangeOne/react-native-mock#141. There is hope RealOrangeOne/react-native-mock#151 will fix it

@julestruong
Copy link

did someone actually find a fix for this ?

@reedyrm
Copy link

reedyrm commented Dec 16, 2017

Adding react-dom solved this problem for me.

@lzapson
Copy link

lzapson commented May 15, 2018

Actually installing "react-dom": "^16.3.2", resolved the problem!

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

No branches or pull requests

9 participants