Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ReferenceError: Property 'Proxy' doesn't exist, js engine: hermes [Mon Feb 08 2021 19:21:54.427] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes #13

Closed
kaneki666 opened this issue Feb 8, 2021 · 42 comments

Comments

@kaneki666
Copy link

when i import {View as MotiView} from 'moti';
i get this error only then.
"@react-native-community/masked-view": "^0.1.10",
"@react-navigation/native": "^5.9.2",
"@react-navigation/stack": "^5.14.2",
"moti": "^0.4.1",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-bootsplash": "^3.1.3",
"react-native-gesture-handler": "^1.9.0",
"react-native-reanimated": "2.0.0-rc.0",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.17.1"

@nandorojo
Copy link
Owner

Please follow the installation instructions entirely.

If you have, then you must be facing an issue with Reanimated: software-mansion/react-native-reanimated#1439

I'm closing this since it's reanimated specific and not reproducible.

@kaneki666
Copy link
Author

i followed the all instruction... i have installed reanimated 2 properly run a example and it works..can you make a example repo of moti so we can play around

@nandorojo
Copy link
Owner

Please make an empty expo project to try to reproduce it. I've tested this successfully on web and native with 2.0.0-rc.0.

There's also an examples folder on this repo.

This looks like a reanimated problem, but see if you can recreate it in an empty project.

@ghmeec
Copy link

ghmeec commented Feb 8, 2021

am getting the same error, the app is created with react native cli and followed all the instruction for installing react native reanimated 2, it only breaks when i import {View,...} from 'moti'

environment
"moti": "^0.4.1",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-reanimated": "2.0.0-rc.0"

@nandorojo
Copy link
Owner

What happens if you try with Expo? It works fine on Expo for me, so it seems like a Reanimated issue.

@kaneki666
Copy link
Author

it only gives me the error when I import moti components..I have run reanimated animation it works fine!
i don't use expo

@kaneki666
Copy link
Author

am getting the same error, the app is created with react native cli and followed all the instruction for installing react native reanimated 2, it only breaks when i import {View,...} from 'moti'

environment
"moti": "^0.4.1",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-reanimated": "2.0.0-rc.0"

same dude

@nandorojo
Copy link
Owner

Without a reproducible example, I don't really know what I can do.

@nandorojo
Copy link
Owner

nandorojo commented Feb 9, 2021

There are 2 examples in the /examples folder if you want to try running them.

https://github.com/nandorojo/moti/tree/master/examples

@kaneki666
Copy link
Author

There are 2 examples in the /examples folder if you want to try running them.

https://github.com/nandorojo/moti/tree/master/examples
With expo yes its working fine. Love the library nice and simple.

if you get time can u make a example with react native cli so we can use this library in production apps.. I tried two new app same error

@nandorojo
Copy link
Owner

Can you upload those examples to a reproducible GitHub repo?

@nandorojo
Copy link
Owner

@cmaycumber have you used a react native CLI example in a monorepo before? I wonder if the setup would be similar to the expo one.

@kaneki666
Copy link
Author

Can you upload those examples to a reproducible GitHub repo?

here is the repo .. i Have installed moti in the reanimated playground repo
https://github.com/kaneki666/moti_demo

@nandorojo
Copy link
Owner

Is this on android?

@kaneki666
Copy link
Author

Is this on android?

yes pixel 2!

@nandorojo
Copy link
Owner

nandorojo commented Feb 9, 2021

Got it, could you try running this repo's examples on android and see what happens? I haven't tested on android.

@kaneki666
Copy link
Author

Got it, could you try running this repo's examples on android and see what happens? I haven't tested on android.

Yes i have tested reanimated example they work fine!
Screenshot (Feb 9, 2021 8_41_55 PM)

@nandorojo
Copy link
Owner

Can you try moti's example?

Just clone this repo, run yarn install, cd examples/with-expo, yarn install && yarn android

@kaneki666
Copy link
Author

oh your expo example works fine i had cloned it and run it..it works

@cmaycumber
Copy link
Contributor

@cmaycumber have you used a react native CLI example in a monorepo before? I wonder if the setup would be similar to the expo one.

Not specifically. I have set up a monorepo outside of the expo managed workflow in the past and it was more difficult to get working. Most of the issues I ran into was related to the file paths that are default for a react-native project.

@ghmeec
Copy link

ghmeec commented Feb 9, 2021

What happens if you try with Expo? It works fine on Expo for me, so it seems like a Reanimated issue.

it works fine with expo

@nandorojo
Copy link
Owner

nandorojo commented Feb 9, 2021

What happens if you try with Expo? It works fine on Expo for me, so it seems like a Reanimated issue.

it works fine with expo

I can try to make a react native CLI project when I have time, but if someone else could try debugging by commenting out different parts of the code until it works that would be useful. I don't use react native CLI.

Just look in @motify/core/src/use-map-props-to-style.ts, and try commenting code out inside of useAnimatedStyle and see what happens until it works.

@kaneki666
Copy link
Author

there is no file named that..there is use-map-animate-to-style.ts

@nandorojo
Copy link
Owner

Oh sorry typo, that's what I meant.

@kaneki666
Copy link
Author

ok i will try what u asked
u meant style variable right 240 line!

@nandorojo
Copy link
Owner

That's right! I would try commenting out everything inside of it (but still return an object), and putting console logs throughout, until you can find the line that breaks it.

@kaneki666
Copy link
Author

got a new kind of error..i tried to run Animated Presence error...and i have returned only obj still same error..might be some other library causing it

ReferenceError: Property 'Proxy' doesn't exist, js engine: hermes
(node:7216) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [HasteMap]. Use emitter.setMaxListeners() to increase limit
[Tue Feb 09 2021 21:57:32.479] ERROR Error: Requiring module "node_modules\framer-motion\dist\framer-motion.cjs.js", which threw an exception: ReferenceError: Property 'Proxy' doesn't exist, js engine: hermes

@nandorojo
Copy link
Owner

This all looks like it's related to Hermès/reanimated

@kaneki666
Copy link
Author

kaneki666 commented Feb 11, 2021

Any update? did you try it on bare rn cli?
just watching this haha
https://www.youtube.com/watch?v=dxWrRuHbh6E

@nandorojo
Copy link
Owner

It would appear that Framer Motion uses Proxy, and Moti imports framer-motion. Hermes doesn't support Proxy, so we need a way around that.

I might have to disable AnimatePresence on Android if there is no polyfill for Hermes.

I wrote more here: software-mansion/react-native-reanimated#1711

@nandorojo
Copy link
Owner

nandorojo commented Feb 11, 2021

I'm not using Hermes yet so I can't test this, and I don't have an Android.

Could you guys please try importing this library's polyfill at the root of your app before importing Moti and see if it fixes it?

https://github.com/GoogleChrome/proxy-polyfill

@kaneki666
Copy link
Author

kaneki666 commented Feb 11, 2021

I'm not using Hermes yet so I can't test this, and I don't have an Android.

Could you guys please try importing this library's polyfill at the root of your app before importing Moti and see if it fixes it?

https://github.com/GoogleChrome/proxy-polyfill

Ok it's midnight here i will try it out tomorrow and let you know...just have to import this index.js right? Or wrap it like Navigation Container?

@nandorojo
Copy link
Owner

I would think so, yes.

@redwanul10
Copy link

got a new kind of error..i tried to run Animated Presence error...and i have returned only obj still same error..might be some other library causing it

ReferenceError: Property 'Proxy' doesn't exist, js engine: hermes
(node:7216) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 change listeners added to [HasteMap]. Use emitter.setMaxListeners() to increase limit
[Tue Feb 09 2021 21:57:32.479] ERROR Error: Requiring module "node_modules\framer-motion\dist\framer-motion.cjs.js", which threw an exception: ReferenceError: Property 'Proxy' doesn't exist, js engine: hermes

i am also facing the same error for last 2 days in react native cli!

@nandorojo
Copy link
Owner

nandorojo commented Feb 13, 2021

Can you try the solution I proposed then?

#13 (comment)

@kylegillen
Copy link

Can you try the solution I proposed then?

#13 (comment)

I tried it. Doesn't work.

@nandorojo
Copy link
Owner

Hmm okay, good to know.

I propose this:

  1. do some googling to see if you can find a way to polyfill Proxy in a Hermès app.
  2. Try using those and let me know.

If there's no luck, I'll have to disable the AnimatedPresence feature for apps using Hermès.

@nandorojo
Copy link
Owner

Here is a conversation about Proxy in Hermès: facebook/hermes#33

Please read through and see if you can try anything that might solve this. Thanks!

@nandorojo
Copy link
Owner

nandorojo commented Feb 15, 2021

Possible solution: upgrade to RN 64 and Hermès v0.7: facebook/hermes#33 (comment)

More info: facebook/hermes#33 (comment)

Or, try npm install hermes-engine@v0.5.2-rc1 if you're using react native 63.x

The Hermès repo has what appears to be solutions. Unfortunately I don't have an android so I can't test this out.

I would really appreciate if everyone who has commented would help investigate and trying the solutions above so we can get to the bottom of it. Thanks!

Update, here is a relevant release for a potential fix where Hermes adds support for Proxy: https://github.com/facebook/hermes/releases/tag/v0.5.2-rc1

@kylegillen
Copy link

Possible solution: upgrade to RN 64 and Hermès v0.7: facebook/hermes#33 (comment)

More info: facebook/hermes#33 (comment)

Or, try npm install hermes-engine@v0.5.2-rc1 if you're using react native 63.x

The Hermès repo has what appears to be solutions. Unfortunately I don't have an android so I can't test this out.

I would really appreciate if everyone who has commented would help investigate and trying the solutions above so we can get to the bottom of it. Thanks!

Update, here is a relevant release for a potential fix where Hermes adds support for Proxy: https://github.com/facebook/hermes/releases/tag/v0.5.2-rc1

install hermes-engine@v0.5.2-rc1 if you're using react native 63.x

^^That did the trick for me. Thanks for the speedy workaround @nandorojo :)

@nandorojo
Copy link
Owner

Awesome! I'll add it to the docs and then close this.

@nandorojo nandorojo reopened this Feb 15, 2021
@nandorojo
Copy link
Owner

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

No branches or pull requests

6 participants