I had an RN app working over a year ago with RN 0.63.4 and tried to update everything to the most recent version of RN and shadow-cljs I can run the app with default App.js but if I switch to the shadow cljs build I get what looks like a path error:
Error: ENOENT: no such file or directory, open '/home/naomarik/sah/mobile-app/react-native/http:/localhost:8081/app/goog.math.long.js'
at Object.openSync (node:fs:599:3)
at Object.readFileSync (node:fs:467:35)
at getCodeFrame (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:1028:18)
at Server._symbolicate (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:1101:22)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Server._processRequest (/home/naomarik/sah/mobile-app/react-native/node_modules/metro/src/Server.js:458:7) {
errno: -2,
syscall: 'open',
code: 'ENOENT',
path: '/home/naomarik/sah/mobile-app/react-native/http:/localhost:8081/app/goog.math.long.js' } ERROR ReferenceError: Property 'Long' doesn't exist, js engine: hermes
The file in question does exist and shadow-cljs compiles successfully.@trybeee wow... this actually worked xD alright so fun times ahead. How did you figure this one out?
@lepistane on Hermes Language Features page it says they plan to target ES6 with some exceptions and then there is a list of supported and in-progress features so you could see what's missing
Hmm, manually fixing the path in index.js output removes the error but still leaves me this:
ERROR ReferenceError: Property 'Long' doesn't exist, js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 10): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient.
A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native., js engine: hermes
Looks like everything works fine without hermes
Just saw these replies, thanks @trybeee that works!
@thheller might be worth updating the shadow-cljs docs to include this point in the react native section? I'm not really familiar with the whole build process and this took me a long time to pinpoint disabling hermes, and would have never guessed it was as easy just to set the compiler option to es5 as dima suggested.
I don't use react-native and know nothing about hermes. no clue why setting :es5 would fix anything either. first time I hear about it
i haven't heard of it either, feels like the foundation to build mobile apps is built on a children ball pit and if you leave it for any amount of time you'll come back to pain
Try adding :compiler-options {:output-feature-set :es5} to https://shadow-cljs.github.io/docs/UsersGuide.html#_output_language_options
https://hermesengine.dev/docs/language-features/#in-progress
I haven’t had any luck with Hermes. My app doesn’t really benefit from its faster startup time (it’s already imperceptible) so I’ve just disabled it.