react-native-reanimated: React Native 0.71.0 - Failed to print error: Cannot read property 'apply' of undefined

Description

console object missing assert and other methods. This causes the debugger to break. Can no longer to make websocket connections or hot module reload while developing.

Steps to reproduce

  1. Upgrade to react-native@0.71.0
  2. Install "react-native-reanimated": "3.0.0-rc.10",
  3. Run app in ios simulator

Snack or a link to a repository

https://github.com/rili-live/therr-app/tree/main/TherrMobile

Reanimated version

3.0.0-rc.10

React Native version

0.71.0

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

None

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 6
  • Comments: 37 (8 by maintainers)

Commits related to this issue

Most upvoted comments

react-native-reanimated: "^2.14.4" shifted to this version will solve your problem Worked for me TESTED

  rm -rf node_modules/
  rm -rf yarn.lock
  yarn
  yarn start --reset-cache
  yarn ios // yarn android

I have created the following patch and the issue seems to be solved for development.

diff --git a/node_modules/react-native-reanimated/lib/module/reanimated2/initializers.js b/node_modules/react-native-reanimated/lib/module/reanimated2/initializers.js
index 591a763..e3f72a2 100644
--- a/node_modules/react-native-reanimated/lib/module/reanimated2/initializers.js
+++ b/node_modules/react-native-reanimated/lib/module/reanimated2/initializers.js
@@ -104,6 +104,7 @@ export function initializeUIRuntime() {
     // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version
 
     global.console = {
+      assert: runOnJS(capturableConsole.assert),
       debug: runOnJS(capturableConsole.debug),
       log: runOnJS(capturableConsole.log),
       warn: runOnJS(capturableConsole.warn),
diff --git a/node_modules/react-native-reanimated/src/reanimated2/initializers.ts b/node_modules/react-native-reanimated/src/reanimated2/initializers.ts
index 9b7efdb..a0f88ee 100644
--- a/node_modules/react-native-reanimated/src/reanimated2/initializers.ts
+++ b/node_modules/react-native-reanimated/src/reanimated2/initializers.ts
@@ -106,6 +106,7 @@ export function initializeUIRuntime() {
     // setup console
     // @ts-ignore TypeScript doesn't like that there are missing methods in console object, but we don't provide all the methods for the UI runtime console version
     global.console = {
+      assert: runOnJS(capturableConsole.assert),
       debug: runOnJS(capturableConsole.debug),
       log: runOnJS(capturableConsole.log),
       warn: runOnJS(capturableConsole.warn),

react-native-reanimated: “2.14.4” is working, but it’s causing the animations to run crazy slow when debugging Android with Chrome (e.g. 10 secs or so to open a Drawer). Do we have any news on a fix for v3?

Still facing the same issue on 0.71.6 with 3.1.0

react-native-reanimated: “^2.14.4” shifted to this version will solve your problem use this version and 1-yarn 2-cd ios 3-pod install 4-cd … 5- yarn start --reset-cache (it is very important step) 6-make sure you close the bundler and close app 7-run new build from xcode

Ok, I reproduced this error on Android. Here is the fix: https://github.com/software-mansion/react-native-reanimated/pull/4474 - works for me 🎉

@mohamedshrif995 Yeah 2.14.4 is already running fine. @ManjodhSaran already mentioned this in comment before, but do you know what is an issue with latest v3.0.2 ??

I have the same problem with react-native 0.71.4 and react-native-reanimated 3.0.2 when Debug with Chrome is activated.

react-native-reanimated is causing lot of issues

just to be sure try to clear metro cache - yarn start --reset-cache

Ok, I reproduced this error on Android. Here is the fix: #4474 - works for me 🎉

Thank you very much! I’ve been struggling with this for a long time. When can I expect a release with a fix?

@mohamedshrif995 Yeah 2.14.4 is already running fine. @ManjodhSaran already mentioned this in comment before, but do you know what is an issue with latest v3.0.2 ??

it work now with last version

react-native-reanimated: "^2.14.4" shifted to this version will solve your problem Worked for me TESTED

  rm -rf node_modules/
  rm -rf yarn.lock
  yarn
  yarn start --reset-cache
  yarn ios // yarn android

This option does not suit me because other libraries need the latest version of react-native-reanimated.

Are there any other options?

react-native-reanimated: "^2.14.4" shifted to this version will solve your problem Worked for me TESTED

  rm -rf node_modules/
  rm -rf yarn.lock
  yarn
  yarn start --reset-cache
  yarn ios // yarn android

WORKING FOR ME

I am also facing this issue. It makes 3.0.2 unusable 😦 Can some take care of it??? @ManjodhSaran solution to downgrade works … I am able to debug android again but it is not a solution for v3 😃