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

Error: TextEncoder is required for this module to work in the browser #177

Open
juberti opened this issue Jul 6, 2023 · 3 comments
Open
Assignees

Comments

@juberti
Copy link
Contributor

juberti commented Jul 6, 2023

Mobile Client Error

Error: TextEncoder is required for this module to work in the browser
ERROR Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
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.

@abranhe
Copy link

abranhe commented Jan 24, 2024

Any updates here?

I have the same issue with the most basic example, so this comment here is out of date #451 (comment) because there is a reason why it is not working. (@petersalas)

This is an issue with an ai-jsx's dependency (tiktoken).

See the code here: https://github.com/dqbd/tiktoken/blob/4a91a815a3db04536bd4848c9307c60553194b45/js/src/core.ts#L67

@petersalas
Copy link
Contributor

Thanks for the additional details! It looks like React Native doesn't have built-in support for TextEncoder. Can you try the workaround suggested in this thread (namely, using a polyfill)?

@abranhe
Copy link

abranhe commented Jan 25, 2024

@petersalas I tried it yesterday, and ran into other issues. I will report my findings or issues.

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

No branches or pull requests

3 participants