React-native-code-push: Error: spawn node_modules/hermesvm/osx-bin/hermes ENOENT

Created on 24 Jun 2020  ·  20Comments  ·  Source: microsoft/react-native-code-push

  1. At First I clean my build directory and again build:
    cd android & ./gradlew clean

./gradlew assembleStagingRelease

  1. Then, When I use command to deploy code-push, with
    appcenter codepush release-react -a <>/<> -m -d Release

I get this error:

node_modules/hermesvm/osx-bin/hermes -emit-binary -out /var/folders/3q/drghm7cs7gzc1c115xzbyg_00000gn/T/code-push2020524-82974-bg9ddv.b1c1l/CodePush/index.android.bundle.hbc /var/folders/3q/drghm7cs7gzc1c115xzbyg_00000gn/T/code-push2020524-82974-bg9ddv.b1c1l/CodePush/index.android.bundle -w
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn node_modules/hermesvm/osx-bin/hermes ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)

Environment

  • react-native-code-push version: "^6.2.0",
  • react-native version: "0.63.0-rc.1",
    "hermes-engine": "^0.5.0",
  • iOS/Android/Windows version: MacOS Mojave v10.14.6
bug waiting-for-clarification

Most helpful comment

Hello @alexandergoncharov , I have the exact same error.

It is because of react-native 0.63.

Can you have a look for a fix ?

All 20 comments

Hi @MahmonirB ,
Thanks for reporting!

I can't reproduce this issue, unfortunately. Could you please provide a demo app with reproducing issue and reprosteps? I would like to reproduce and investigate this issue.

Hi @MahmonirB,

I'm going to close this issue for now as I haven't heard from you in a while, unfortunately.
Please feel free to reopen it if you have any questions.

Hello @alexandergoncharov , I have the exact same error.

It is because of react-native 0.63.

Can you have a look for a fix ?

Hello, any news about this ?

I think it is because of the Hermes path, it changed in the RN 0.63 release (because they upgraded Hermes from 0.4.0 to 0.5.0) : https://github.com/facebook/react-native/commit/4305a291a9408ca65847994bbec42f1fbc97071d

Thanks,

+1, any ETA for this issue fix?

+1

node_modules/hermesvm/osx-bin/hermes -emit-binary -out /var/folders/1d/mgglm_zx4jbcf_fkydmdz72w0000gn/T/code-push2020630-7966-1jrm0yp.k0hu/CodePush/index.android.bundle.hbc /var/folders/1d/mgglm_zx4jbcf_fkydmdz72w0000gn/T/code-push2020630-7966-1jrm0yp.k0hu/CodePush/index.android.bundle -w

events.js:298
throw er; // Unhandled 'error' event
^

Error: spawn node_modules/hermesvm/osx-bin/hermes ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn node_modules/hermesvm/osx-bin/hermes',
path: 'node_modules/hermesvm/osx-bin/hermes',
spawnargs: [
'-emit-binary',
'-out',
'/var/folders/1d/mgglm_zx4jbcf_fkydmdz72w0000gn/T/code-push2020630-7966-1jrm0yp.k0hu/CodePush/index.android.bundle.hbc',
'/var/folders/1d/mgglm_zx4jbcf_fkydmdz72w0000gn/T/code-push2020630-7966-1jrm0yp.k0hu/CodePush/index.android.bundle',
'-w'
]
}

@MahmonirB @JB-CHAUVIN @sivakumarjcn @MagicMirouff
0.63.0-rc.0 use 0.4.0 Hermes

step1:downgrade react-native
yarn add [email protected]

step2:rebuild project (Android)
cd android && ./gradlew clean

step3:restart node
react-native start --reset-cache

step4:upload bundle again
appcenter codepush release-react -a <appOwner>/<appName>-d Staging

I solved the problem in this way,I hope it can help you too 🎉,and thank you for your ideas @JB-CHAUVIN

+1

I can confirm that the problem is the change of Hermes’ path in the 0.63 react native release.

I made a fix by cloning react native code push and changes Hermes path.

Just patch react-native-code-push with the new hermes path and it will work 👍

https://github.com/microsoft/react-native-code-push/issues/1886#issuecomment-660981968

I can confirm that the problem is the change of Hermes’ path in the 0.63 react native release.

I made a fix by cloning react native code push and changes Hermes path.

Just patch react-native-code-push with the new hermes path and it will work 👍

#1886 (comment)

What were the changes you made to react-native-code-push? I cannot find any mention of hermes in this repositories' code-base.

I can confirm that the problem is the change of Hermes’ path in the 0.63 react native release.

I made a fix by cloning react native code push and changes Hermes path.

Just patch react-native-code-push with the new hermes path and it will work 👍

#1886 (comment)

can you share the changes required in react-native-code-push

+1
encountered this issue, we created a script to rename node_modules/hermesvm/osx-bin/hermesc to just hermes for code-push to work again (at least temporarily).

Hi, excuse me for my late.
Finally, I created new [email protected], before copying all js files, I installed react-native-code-push on it, it works fine.

+1
Any updates?

I don't know if this is the same change that @JB-CHAUVIN suggested but it worked for me. In the appcenter-cli package edit this file; appcenter-cli/dist/commands/codepush/lib/react-native-utils.js. On line 361 change return 'hermes' to return 'hermesc'. My version of appcenter-cli is 2.6.5. This is what you would be looking for;

function getHermesOSExe() {
    switch (process.platform) {
        case "win32":
            return "hermes.exe";
        default:
            return "hermesc";
    }
}

@jmarkstevens Kudos. We just figured out the same,

To add on to it, find out the path to global node_modules use npm root -g and find the appcenter-cli folder

Hey everyone. Thanks to @jmarkstevens for clear steps on how to temporarily fix this issue.

For full yarn install integration, feel free to follow these steps:

  1. Setup the awesome patch-package (https://www.npmjs.com/package/patch-package)
  2. Create a /patches directory and add a new file called appcenter-cli+2.6.2.patch (or whatever version of appcenter-cli you're using) with the following contents:
diff --git a/node_modules/appcenter-cli/dist/commands/codepush/lib/react-native-utils.js b/node_modules/appcenter-cli/dist/commands/codepush/lib/react-native-utils.js
index 228e9ea..0aeed76 100644
--- a/node_modules/appcenter-cli/dist/commands/codepush/lib/react-native-utils.js
+++ b/node_modules/appcenter-cli/dist/commands/codepush/lib/react-native-utils.js
@@ -358,7 +358,7 @@ function getHermesOSExe() {
         case "win32":
             return "hermes.exe";
         default:
-            return "hermes";
+            return "hermesc";
     }
 }
 function getHermesCommand() {

The fix should now work throughout your ecosystem 🥳

Hi @MahmonirB
Thanks for the reporting.

We have fixed this bug in the new version of the App Center CLI.

Finally in React native 0.63.3, I uninstall [email protected] and install [email protected].

change the binary file
/node_modules/hermes-engine/osx-bin/hermesc
to
/node_modules/hermes-engine/osx-bin/hermes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quanzaiyu picture quanzaiyu  ·  3Comments

kevando picture kevando  ·  4Comments

chrisjrex picture chrisjrex  ·  4Comments

panarasi picture panarasi  ·  4Comments

DeDuckProject picture DeDuckProject  ·  3Comments