-
-
Notifications
You must be signed in to change notification settings - Fork 153
Cannot find module 'react/lib/ReactComponentTreeHook' from 'ReactDebugTool.js' #141
Comments
I've checked that the module
var ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook'); However, React-Native 0.45 and 0.46 depends on |
I've got the same problem - I'm using Mocha. I get: `module.js:471 Error: Cannot find module 'react/lib/ReactComponentTreeHook'` I'm using react-native 0.46.4 |
This issue would resolve itself if |
The hook was moved from addons to a different location for React 16 as per facebook/react@f2fc182. I'm trying to get this to work with |
React 16 Beta is out and they have oficially said perf add-ons wont be coming back the same way it was before |
and how to fix? |
What worked for me was to downgrade to react-native 0.44.x for the time being. Although I'm using create-react-native-app / expo, so I'm not sure if this will work for others. |
I'm having the same issue here but my error is coming from |
I resolved by upgrading my node to v8.3.0 (npm v5.3.0), removing all the node_modules and then installing all again. Btw, I'm using yarn. |
@RealOrangeOne , what is the plan to resolve this? |
Is there any valid workarounds except for downgrading react-native? I'm using the latest version of it now. |
I've tried to fork this and upgrade it to depend on the latest react but I couldn't get perf tools to work (latest release seems to target |
I made a very simple fork and we can use it for the time being until an officially release. |
@shqld for a very simple fork you've committed a whole lot of unrelated stylistic changes 😞 |
@patrys It's like a mock of the future release of this library just for me😞 Fixing some syntax was due to console errors emitted when testing with Jest. |
@shqld I'm using your fork in my package.json like this: |
@timurridjanovic It's intended that there's no |
@RealOrangeOne you said "This issue would resolve itself if react@16 would come out of alpha" but I'm not sure if react-native-mock is fully compatible with react 16. React 16 is out of alpha now, so I tried using your package with react version 16.0.0 (and the latest version of react-native 0.48.4), but I still seem to be getting an error when running my tests using react-native-mock (although it does seem to now be a different error from the ReactComponentTreeHook error we were originally getting):
|
All prop types have to be moved from React to the prop-types package to support React 16. Also, all propTypes from cjcheshire/react-native-multi-slider@6f0d2cb#diff-c71c6f99b408b5a1afd81a3839ce5d4b |
@gabceb We are tomorrow :) |
I found this issue today, when I tried to test my RN components with I am using:
If somebody has a solution for this it would be very helpful |
@jcguarinpenaranda think the author mentions the package is not working with react in alpha. |
What is the solution to this error - sorry, I don't understand what #130 suggests as a solution to this error: Uncaught Error: Cannot find module "react/lib/ReactComponentTreeHook" |
At GitPoint, we're using @shqld's fork (https://github.com/shqld/react-native-mock) and it's working fine. I'd suggest using that until #130 is merged (hopefully soon...) |
@andrewda I still get errors with @shqld 's fork.
With following dependencies
|
@fdnhkj I'm not sure but try again with |
Did someone actually make this work ? |
I'm seeing |
@shqld I'm having issues with your fork also,
Using react-native 0.47.2 |
Any update on this? Still have this issue now. package.json: { Hope this get fixed quickly |
@akahd I have a similar set up to you, and my tests are running without the error. Try to update to latest version of react-dom (16.2.0) and react-native (0.49.3). I'm also using an older version of jest (18.1.0), and I don't have react-addons-perf although that shouldn't interfere with anything. |
A solution I found here was: Installing compatible |
My solution is to replace |
After adding and importing this lib, testing with jest shows errors for all test suites:
Part of
package.json
:Those errors are raised from
react-addons-perf
which is depended byreact-native-mock
. The version ofreact-addons-perf
is15.4.2
. I'm not sure whether it is related to the version ofreact
(16.0.0-alpha.12
).The text was updated successfully, but these errors were encountered: