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

React native 0.68.2 iOS with Hermes enabled not able to load the application, metro error #1568

Closed
chirag-blueed opened this issue Nov 22, 2024 · 4 comments

Comments

@chirag-blueed
Copy link

Can you suggest a solution, or is this issue specific to iOS when Hermes is enabled?
Note: This happens only with hermes enabled in my project, with default JavaScript Core it is working fine
Can some one suggest a fix of it

ERROR ReferenceError: Property 'module' doesn't exist, js engine: hermes Error: ENOENT: no such file or directory, open '/Users//Workspace//webpack:/multi_./src/index.js?' at Object.openSync (node:fs:596:3) at Object.readFileSync (node:fs:464:35) at getCodeFrame (/Users//Workspace//node_modules/metro/src/Server.js:949:18) at Server._symbolicate (/Users//Workspace//node_modules/metro/src/Server.js:1022:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Server.processRequest (/Users//Workspace//node_modules/metro/src/Server.js:429:7) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/Users//Workspace//webpack:/multi./src/index.js?'

image

Error: ENOENT: no such file or directory, open '/Users/*/Workspace/*/*/webpack:/multi_./src/index.js?' at Object.openSync (node:fs:596:3) at Object.readFileSync (node:fs:464:35) at getCodeFrame (/Users/*/Workspace/*/*/node_modules/metro/src/Server.js:949:18) at Server._symbolicate (/Users/*/Workspace/*/*/node_modules/metro/src/Server.js:1022:22) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Server._processRequest (/Users/*/Workspace/*/*/node_modules/metro/src/Server.js:429:7) { errno: -2, syscall: 'open', code: 'ENOENT', path: '/Users/upforcetech/Workspace/*/*/webpack:/multi_./src/index.js?' }

@chirag-blueed chirag-blueed added the bug Something isn't working label Nov 22, 2024
@tmikov tmikov removed the bug Something isn't working label Nov 22, 2024
@tmikov
Copy link
Contributor

tmikov commented Nov 22, 2024

From your screenshot, your code is relying on "local eval", that is compilation of JavaScript source at runtime in the context of a function, accessing symbols declared in that function.

(function(module) {
   eval("module.exports = ...."); 
   ...
})

Local eval is not supported by Hermes (in general Hermes is optimized for running from bytecode - compilation from source on device is very slow).

@tmikov tmikov closed this as completed Nov 22, 2024
@chirag-blueed
Copy link
Author

But @tmikov how can I fix this? Could you please help me?

@chirag-blueed
Copy link
Author

chirag-blueed commented Nov 22, 2024

The release build works fine, but the debug build has issues when connected to the Metro server bundler.
@tmikov Can you re-open the bug?

@tmikov
Copy link
Contributor

tmikov commented Nov 22, 2024

Sorry, @chirag-blueed, I wish I could help you, but I don't have a good practical understanding of how JS apps are packaged and built in practice. The Hermes team deals primarily with C++ and narrow JS language features. You might have better luck asking in React Native.

Take the following with a grain of salt: From what I can tell, there is Webpack usage in your code, and for some reason it is wrapped in an eval(). No idea why, but that's where I would start. AFAIK, RN apps are usually packaged with Metro, not Webpack.

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

2 participants