React-native: [0.60.2] Build failing when enabling Hermes (enableHermes: true)

Created on 11 Jul 2019  ·  110Comments  ·  Source: facebook/react-native

Build is failing when I enable Hermes in android/app/build.gradle

Error:
image

React Native version:

System:
OS: macOS 10.14.5
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 71.63 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28
Build Tools: 21.1.2, 23.0.1, 25.0.0, 25.0.1, 25.0.2, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.2, 28.0.3, 29.0.0
System Images: android-23 | Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-27 | Android TV Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5522156
Xcode: 10.2/10E125 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.2 => 0.60.2
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-create-library: 3.1.2
react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. Follow the steps mentioned in hermes
  2. react-native run-android --variant release

Describe what you expected to happen:
Build to pass after enabling Hermes

Snack, code example, or link to a repository:

https://github.com/bhaskarGyan/react-native-memory-profile/tree/bug/rn-0.60.2_hermes

Bug Hermes Stale

Most helpful comment

I have same issue with 0.60.3 in --variant release
(in dev is ok )

  • What went wrong:
    Execution failed for task ':app:bundleReleaseJsAndAssets'.
    > A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''

All 110 comments

This seems to be caused by the hard-coded path to the hermes binary, here: https://github.com/facebook/react-native/blob/0.60-stable/react.gradle#L19

My npm install ended up placing it in a different location in node_modules, so I did the following in my android/app/build.gradle:

project.ext.react = [
    ...
    hermesCommand: "../../node_modules/hermesvm/%OS-BIN%/hermes",
    ...
]

@bhaskarGyan this issue has been fixed in #25598

I have the same error :/ @bhaskarGyan did you solve it?

cc @bhaskarGyan @burhanyilmaz to fix this issue use the 0.60.3 React Native version

@ecreeth I actually just installed 0.60.3 and my build succeeded , but the app crashes on start

@ecreeth Thanks I solved this via #25598
it is really fast :)

@Karniej The React Native Team, recommend making sure everything works before trying to switch to Hermes. If everything is fine with your application, but with Hermes your application is broken, please send a issue

I have same issue with 0.60.3 in --variant release
(in dev is ok )

  • What went wrong:
    Execution failed for task ':app:bundleReleaseJsAndAssets'.
    > A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''

@farshidshahmoradi1996 I'm not sure, but I think that before using the command, we must take a few steps before. Here
image

when I open hermes.exe from node_modules\hermesvm\win64-bin that take error :

Capture

OS :win 8.1 (x64)

that problem comes from my windows?
I have this problem only in release version

@ecreeth, #25598 fix the build issue but now the App is crashing on Startup.
Raised new issue #25601

I can close this issue if build is working for @farshidshahmoradi1996

@bhaskarGyan build is not working in --variant release

There is no problem production and development in my app. But not starting js server when running react-native run-android.
There is a solution that react-native start & react-native run-android. it is not good.
Hermes cause this problem? @ecreeth

Fixed in 0.60.3.

Fixed in 0.60.3.

Not fixed under windows indeed.

cc @willholen

As @farshidshahmoradi1996 said that, while run
node_modules\hermesvm\win64-bin\hermes.exe
individually. it told me it's lack of some dlls.

So I search and download this icu4c-64_2-Win64-MSVC2017.zip, unzip it and put relative dll to \windows folder, then run hermes.exe again, there's no error showing again.
But when run
react-native run-android --variant=release
still failed with same error:

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''

investigated some time on it, I found that running hermes.exe need those dlls

api-ms-win-crt-convert-l1-1-0.dll
api-ms-win-crt-environment-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-time-l1-1-0.dll
api-ms-win-crt-utility-l1-1-0.dll
icudt64.dll
icuin64.dll
icuuc64.dll

and with those dlls in \Windows dir, I can run
echo "'use strict'; function hello() { print('Hello World'); } hello();" | ./hermes
in Git-Bash and get "Hello World". But still when try to compile the apk, it failed.
Should be close to the solution.

use hermes to compile the bundle file, I can get new bundle file, but with those error logs.

Is this means the hermes is not a complete engine for windows?

./node_modules/hermesvm/win64-bin/hermes -emit-binary -out index.bundle  C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle -O -output-source-map
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:13:147: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...Info,c=new Map,u={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return Pr...
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:23:2880: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...hrow",value:function(){return'undefined'!=typeof DebuggerInternal&&!0===DebuggerInternal.shouldPauseOnThrow}},{key...
                                                    ^~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:24063: warning: the variable "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in function "Lt"
...{}}}function Lt(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HO...
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:56221: warning: the variable "setTimeout" was not declared in function "Ni"
...BoundaryFound=!0,t.willRetry=!0);try{Ci(t)}catch(e){setTimeout(function(){throw e})}}function zi(e){var t=e.ref;if...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:22078: warning: the variable "clearTimeout" was not declared in function " 212#"
...etChildren(e._nativeTag,t),!1}var xt=setTimeout,St=clearTimeout,wt=/^(.*)[\\\/]/;function kt(e){var t="";do{e:swit...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:82109: warning: the variable "nativeFabricUIManager" was not declared in function " 247#"
...;try{r=t(this)}catch(e){}null!=r&&(r.canonical?nativeFabricUIManager.measure(r.node,pt(this,n)):c.measure(e(this),...
                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:100:795: warning: the variable "setImmediate" was not declared in function "h 6#"
..._72,t])):void n._72.push(t);h(n,t)}function h(n,u){setImmediate(function(){var c=1===n._65?u.onFulfilled:u.onRejec...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:109:177: warning: the variable "Worker" was not declared in function " 361#"
...ent),t={canUseDOM:n,canUseWorkers:'undefined'!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!...
                                                         ^~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:96: warning: the variable "fetch" was not declared in function " 423#"
...;var s=r(d[0]);s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},1...
                                                          ^~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:110: warning: the variable "Headers" was not declared in function " 423#"
...s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:126: warning: the variable "Request" was not declared in function " 423#"
...orts=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:143: warning: the variable "Response" was not declared in function " 423#"
...fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1539: warning: the variable "FileReader" was not declared in function "p 13#"
...or=function(){n(t.error)}})}function p(t){var o=new FileReader,n=l(o);return o.readAsArrayBuffer(t),n}function b(t...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1973: warning: the variable "Blob" was not declared in function " 432#"
...dyInit=t,t?'string'==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData...
                                                          ^~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2034: warning: the variable "FormData" was not declared in function " 432#"
...totype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.se...
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2107: warning: the variable "URLSearchParams" was not declared in function " 432#"
...ototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toSt...
                                                     ^~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:6805: warning: the variable "XMLHttpRequest" was not declared in function " 439#"
...t.DOMException('Aborted','AbortError'));var y=new XMLHttpRequest;function l(){y.abort()}y.onload=function(){var t,...
                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:280: warning:...meout?clearTimeout:void 0,c="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,f="function"==ty...

                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:352: warning:
 the variable "cancelAnimationFrame" was not declared in function " 538#"
...uestAnimationFrame:void 0,f="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0,p=void 0,v=void 0;...

                                                  ^~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:527: warning:
 the variable "performance" was not declared in function " 538#"
...{f(p),n(e.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var y=perform...

                                                       ^~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:733: warning:
 the variable "MessageChannel" was not declared in function " 538#"
...if("undefined"==typeof window||"function"!=typeof MessageChannel){var w=null,_=function(n){if(null!==w)try{w(n)}fi...

                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:267:2395: warning
: the variable "clearImmediate" was not declared in function " 1025#"
...Transition:'fade'},f._updatePropsStack=function(){clearImmediate(f._updateImmediate),f._updateImmediate=setImmedia...

                                                     ^~~~~~~~~~~~~~

I got error:
A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''
React Native versioin:0.60.3

The same issue on osx-bin:

I got error:
A problem occurred starting process 'command '../../node_modules/hermesvm/osx-bin/hermes''
React Native versioin:0.60.3

Same issue on windows and version 0.60.3

  • What went wrong:
    Execution failed for task ':app:bundleReleaseJsAndAssets'.
    > A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''

modify react.gradle file to add cmd /c before execute hermes can solve the error message. but no matter how, hermes cannot translate some elements as my previous comment is the problem. this makes the return result not zero. then the process stop there.

0.60.3 same problem:
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''

Caused by: net.rubygrapefruit.platform.NativeException: Could not start '....node_moduleshermesvm\win64-bin\hermes'

Same here with 0.60.3:
Execution failed for task ':app:bundleReleaseJsAndAssets'.

A problem occurred starting process 'command '....node_moduleshermesvm\win64-bin\hermes''
Any news about this problem?

Hermes requires the Microsoft Visual C++ 2015 Redistributable, and the ICU4C libraries which were accidentally omitted in the first NPM release (but can be found on the GitHub release).

There are undoubtedly several issues at work in this thread though. We're aiming to publish a new NPM this week to address several of them.

@willholen
It seems some support files are not there? which makes the compilation to byte code failed.

__fbBatchedBridgeConfig is not set, cannot invoke native modules
Failed to print error:  Requiring module "8", which threw an exception: Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules
Invariant Violation: __fbBatchedBridgeConfig is not set, cannot invoke native modules

It's just a plain sample created with react-native init test_app, no other elements added.

I am facing same error

Error: Command failed: gradlew.bat app:installRelease -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''

I have the same problem

Steps

react-native init HermesTest
cd HermesTest/
# android/app/build.gradle

-enableHermes: false
+enableHermes: true
cd android
./gradlew clean
./gradlew assembleRelease

react-native info

System:
    OS: Linux 4.15 Linux Mint 19.1 (Tessa)
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 1.55 GB / 15.51 GB
    Shell: 2.7.1 - /usr/bin/fish
  Binaries:
    Node: 10.16.0 - /usr/bin/node
    Yarn: 1.16.0 - ~/.yarn/bin/yarn
    npm: 6.9.0 - /usr/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.3 => 0.60.3 
  npmGlobalPackages:
    create-react-native-web-app: 0.1.14
    react-native-cli: 2.0.1
    react-native-create-library: 3.1.2


Error log

Task :app:bundleReleaseJsAndAssets
warning: the transform cache was reset.
Loading dependency graph, done.
info Writing bundle output to:, /home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle
info Writing sourcemap output to:, /home/i/tmp/HermesTest/android/app/build/intermediates/sourcemaps/release/index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 2 asset files
info Done copying assets

// ...

/home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle:267:2395: warning: the variable "clearImmediate" was not declared in function " 1025#"
__d(function(g,r,i,a,m,e,d){'use strict';var t,n=r(d[0]),l=r(d[1]),u=r(d[2]),o=r(d[3]),c=r(d[4]),s=r(d[5]),p=r(d[6]),k=(r(d[7]),r(d[8])),v=r(d[9]).StatusBarManager;function y(t){return{backgroundColor:null!=t.backgroundColor?{value:t.backgroundColor,animated:t.animated}:null,barStyle:null!=t.barStyle?{value:t.barStyle,animated:t.animated}:null,translucent:t.translucent,hidden:null!=t.hidden?{value:t.hidden,animated:t.animated,transition:t.showHideTransition}:null,networkActivityIndicatorVisible:t.networkActivityIndicatorVisible}}var f=(function(t){function s(){var t,l;n(this,s);for(var c=arguments.length,p=new Array(c),k=0;kvalue:function(){this._stackEntry=s.pushStackEntry(this.props)}},{key:"componentWillUnmount",value:function(){s.popStackEntry(this._stackEntry)}},{key:"componentDidUpdate",value:function(){this._stackEntry=s.replaceStackEntry(this._stackEntry,this.props)}},{key:"render",value:function(){return null}}],[{key:"setHidden",value:function(t,n){n=n||'none',s._defaultProps.hidden.value=t,v.setHidden(t)}},{key:"setBarStyle",value:function(t,n){n=n||!1,s._defaultProps.barStyle.value=t,v.setStyle(t)}},{key:"setNetworkActivityIndicatorVisible",value:function(t){console.warn('setNetworkActivityIndicatorVisible is only available on iOS')}},{key:"setBackgroundColor",value:function(t,n){n=n||!1,s._defaultProps.backgroundColor.value=t,v.setColor(k(t),n)}},{key:"setTranslucent",value:function(t){s._defaultProps.translucent=t,v.setTranslucent(t)}},{key:"pushStackEntry",value:function(t){var n=y(t);return s._propsStack.push(n),s._updatePropsStack(),n}},{key:"popStackEntry",value:function(t){var n=s._propsStack.indexOf(t);-1!==n&&s._propsStack.splice(n,1),s._updatePropsStack()}},{key:"replaceStackEntry",value:function(t,n){var l=y(n),u=s._propsStack.indexOf(t);return-1!==u&&(s._propsStack[u]=l),s._updatePropsStack(),l}}]),s})(p.Component);f._propsStack=[],f._defaultProps=y({animated:!1,showHideTransition:'fade',backgroundColor:null!=(t=v.DEFAULT_BACKGROUND_COLOR)?t:'black',barStyle:'default',translucent:!1,hidden:!1,networkActivityIndicatorVisible:!1}),f._updateImmediate=null,f._currentValues=null,f.currentHeight=v.HEIGHT,f.defaultProps={animated:!1,showHideTransition:'fade'},f._updatePropsStack=function(){clearImmediate(f._updateImmediate),f._updateImmediate=setImmediate(function(){var t,n,l=f._currentValues,u=(t=f._propsStack,n=f._defaultProps,t.reduce(function(t,n){for(var l in n)null!=n[l]&&(t[l]=n[l]);return t},s({},n)));l&&l.barStyle.value===u.barStyle.value||v.setStyle(u.barStyle.value),l&&l.backgroundColor.value===u.backgroundColor.value||v.setColor(k(u.backgroundColor.value),u.backgroundColor.animated),l&&l.hidden.value===u.hidden.value||v.setHidden(u.hidden.value),l&&l.translucent===u.translucent||v.setTranslucent(u.translucent),f._currentValues=u})},m.exports=f},261,[22,23,30,33,36,11,47,43,67,8]);

Stack dump:

  1. Program arguments: ../../node_modules/hermesvm/linux64-bin/hermes -emit-binary -out /home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle /home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle -O -output-source-map
  2. Program arguments: ../../node_modules/hermesvm/linux64-bin/hermes -emit-binary -out /home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle /home/i/tmp/HermesTest/android/app/build/generated/assets/react/release/index.android.bundle -O -output-source-map
    [0x41ba83]
    [0x41abc9]
    [0x41ac6c]
    [0x4265e0]
    [0x499f43]
    [0x49a163]
    [0x43d7ff]
    [0x43d967]
    [0x44003a]
    [0x4399b2]
    [0x439b32]
    [0x42b8b9]
    [0x4308d6]
    [0x40487b]
    [0x712f34]
    [0x7131b1]
    [0x408116]
    [0x41ba83]
    [0x41abc9]
    [0x41ac6c]
    [0x4265e0]
    [0x499f43]
    [0x49a163]
    [0x43d7ff]
    [0x43d967]
    [0x44003a]
    [0x4399b2]
    [0x439b32]
    [0x42b8b9]
    [0x4308d6]
    [0x40487b]
    [0x712f34]
    [0x7131b1]
    [0x408116]

Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

  • Where:
    Script '/home/i/tmp/HermesTest/node_modules/react-native/react.gradle' line: 139

  • What went wrong:
    Execution failed for task ':app:bundleReleaseJsAndAssets'.

    Process 'command '../../node_modules/hermesvm/linux64-bin/hermes'' finished with non-zero exit value 135

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 12s
5 actionable tasks: 2 executed, 3 up-to-date

Hello,
I'm facing same issue with react-native v0.60.4

I ran a build with a debug variant and a built with a release variant and both result same error output :

Process 'command '../../node_modules/hermesvm/linux64-bin/hermes'' finished with non-zero exit value 135

Here is the result of react-native info

System:
    OS: Linux 5.0 Ubuntu 19.04 (Disco Dingo)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 3.15 GB / 15.38 GB
    Shell: 5.0.3 - /bin/bash
  Binaries:
    Node: 10.15.2 - /usr/bin/node
    Yarn: 1.12.3 - /usr/bin/yarn
    npm: 6.9.0 - ~/.npm-global/bin/npm
  SDKs:
    Android SDK:
      API Levels: 23, 25, 26, 27, 28
      Build Tools: 23.0.3, 27.0.3, 28.0.3
      System Images: android-27 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: 19.2.5345600
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4 
  npmGlobalPackages:
    create-react-native-app: 2.0.2
    react-native-cli: 2.0.1
    react-native-git-upgrade: 0.2.7
    react-native-rename: 2.2.2
    react-native: 0.60.2

Same issue RN0.60.4 in my project, which I upgraded to last RN version to try Hermes.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''

If i make a new empty project using _react-native init testhermes_ , enable Hermes in build.gradle
the project builds and runs in debug mode as expected. The welcome-screen says that hermes is active.
It seems to be a lack in documentation about how to migrate project from earlier RN versions to make hermes work as supposed.

@pavelustenko There is an application that help you to upgrade react-native : https://react-native-community.github.io/upgrade-helper

I have the exact same issue

Process 'command '../../node_modules/hermesvm/linux64-bin/hermes'' finished with non-zero exit value 135

Facing same issue on LINUX, on mac it is working fine.

Anyone found the solution?

Linux issue looks related to https://github.com/facebook/hermes/issues/45

Same issue on windows with 0.60.4.

Same issue. Please fix hermes issue asap. Unable to build release build. debug build works with hermes.
I am using Windows 7 Ultimate 64-bit.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> A problem occurred starting process 'command '..\..\node_modules\hermesvm\win6
4-bin\hermes''

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2m 27s

    at checkExecSyncError (child_process.js:616:11)
    at execFileSync (child_process.js:634:13)
    at runOnAllDevices (E:\Documents\Projects\MyApps\UPDATED APPS\Motivator\node
_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\
runOnAllDevices.js:75:39)
    at buildAndRun (E:\Documents\Projects\MyApps\UPDATED APPS\Motivator\node_mod
ules\@react-native-community\cli-platform-android\build\commands\runAndroid\inde
x.js:169:41)
    at then.result (E:\Documents\Projects\MyApps\UPDATED APPS\Motivator\node_mod
ules\@react-native-community\cli-platform-android\build\commands\runAndroid\inde
x.js:135:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Thanks,
Er Harinder Singh

For me is working in release mode using react-native 0.60.4, then you can something like this to be tested.

1. ./gradlew clean && ./gradlew assembleRelease
2. sudo jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore app-release-unsigned.apk my-alias
3. adb install app-release-unsigned.apk
System:
    OS: macOS 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
    Memory: 20.08 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: 1.15.2 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 21, 22, 23, 24, 26, 27, 28
      Build Tools: 28.0.3
      System Images: android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, andro
id-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.8.6 => 16.8.6 
    react-native: ^0.60.4 => 0.60.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1

https://facebook.github.io/react-native/docs/hermes

@skantus What is your OS ?

@skantus What is your OS ?

@Thebarda I have updated my comment above.

Apparently, bundle JS and Assets works on Mac OS but not on Windows / Linux :/

Ok, first one I follow the description of the issue that basically the problem has occurred in Mac OS, maybe my steps can be util, about Linux and Windows I hope the react-native team can gives us some answers soon.

So exactly how do we fix this error on Windows?

I found that if you execute the build command with --stacktrace it says command '....node_moduleshermesvm\win64-bin\hermes' not found (mind the quotes) when you execute the same command from the 'app' directory, where the command gets executed from the release buld script, without the quotes it actually 'works' couldn't test it more because I'm on vacation now but removing the quotes might be a fix?(!). This is on windows btw.

Sorry about the delay! We are having some internal build issues that are blocking the release of an updated version.

We are in the process of migrating the NPM name from hermesvm to hermes-engine, which is already published and does include the ICU dlls for Windows (it's otherwise identical). We hoped to have a new react-native release days ago that could switch over, and we're still aiming to get that out shortly.

If you want to try to troubleshoot the issue on your own in the mean time, you can yarn add hermes-engine and set hermesCommand = "../../node_modules/hermes-engine/%OS-BIN%/hermes" in your project.ext.react, though I don't know how many issues in this thread it would be effective for.

I tried that, had to make my hermesCommand with less ../ so it would look like this
hermesCommand: "../node_modules/hermes-engine/%OS-BIN%/hermes"
now hermes can be found by gradle but it gives me this error:
Failed to open file C:\test-project\android\app\build\generated\assets\react\release\index.android.bundle: The requested operation cannot be performed on a file with a user-mapped section open.
Any ideas @willholen?

well it turns out that hermes cannot write to the same file it's reading because hermes does not unlocking the file I could confirm hermes working by changing the -out to a different file name in the same directory and it worked... I guess we need to write to a different file and then delete the old file and rename the new file to the old one somehow?
or hermes should unlock the file it's reading before writing anyways

EDIT: Yup, it worked
changed line 154 in react.gradle from:
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)
to

                        commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFileDummy, jsBundleFile, *hermesFlags)
                        commandLine("cmd", "del", jsBundleFile)
                        commandLine("cmd", "move", jsBundleFileDummy, jsBundleFile)
                        if (jsBundleFileDummyMap.exists()) {
                            commandLine("cmd", "move", jsBundleFileDummyMap, jsBundleFileMap)
                        }

and line 78 from:
def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
to:

        def jsBundleFile = file("$jsBundleDir/$bundleAssetName")
        def jsBundleFileDummy = file("$jsBundleDir/$bundleAssetName-dummy")
        def jsBundleFileMap = file("${jsBundleFile}.map")
        def jsBundleFileDummyMap = file("${jsBundleFileDummy}.map")

And now it does works, I could run it and confirmed that it uses Hermes engine in both debug and release mode

@sijav Ah, this should already be fixed in hermes' 5fb66d22. Yours is a good workaround in the mean time.

@sijav
I had to add "cmd", "/c" before getHermesCommand(), or else it counld'nt execute.
commandLine("cmd", "/c", getHermesCommand(), "-emit-binary", "-out", jsBundleFileDummy, jsBundleFile, *hermesFlags)
But with following two command

commandLine("cmd", "del", jsBundleFile)
commandLine("cmd", "move", jsBundleFileDummy, jsBundleFile)

It will delete all dummy bundle file and dummy map file. so the excuation failed again.
I had to comment this two command and move it to next section.
It seems while using cmd /c to execute the hermes compiler, it goes to next command directly without waiting for finished state.

@zenz , @sijav , @willholen ... Nothing works for me till now. I tried your each replies code. But always failed to build a release apk. When official fix is coming @willholen ?

@ErHarinderSingh
First add hermes-engine
yarn add --dev [email protected]
Then try to enable hermes in android/app/build.gradle with

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]

and then replace node_module/react-native/react.gradle with this file:
workable react.gradle file

I think this time you can make it to run with command
react-native run-android --variant release
or use
./gradlew assembleRelease to build your app on Windows.

@ErHarinderSingh try run ./gradlew assembleRelease --stacktrace --info in android folder and see what cause your problem...

@zenz found the problem, lol we put all those codes along side on exec...
I found a better solution,
change line 132 and 136 from:
"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir,
to
"--reset-cache", "--entry-file", entryFile, "--bundle-output", enableHermes ? jsBundleFileDummy : jsBundleFile, "--assets-dest", resourcesDir,

change hermes command line to this
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFileTemp, *hermesFlags)
this way we create temp file and hermes files out of temp file in the right section and now after exec { ... } we can delete the file instead of moving the file
delete jsBundleFileTemp
I can see they have already implemented this on the master

@sijav tried the react.gradle in the master branch and it built successfully but I am getting this error (crashes on it): com.facebook.jni.CppException: Wrong bytecode version. Expected 59 but got 60. Any solution? I did run yarn add hermes-engine before building.

I build apk successfully; but it crashes every time. App is installing but crashes each time when trying to open.
Untitled

for me the error is:

Cannot run program "..\..node_moduleshermes-engine\win64-bin\hermes" : The system cannot find the file specified

@javadi69 try this maybe?
hermesCommand: "../node_modules/hermes-engine/%OS-BIN%/hermes"

@javadi69 try this maybe?
hermesCommand: "../node_modules/hermes-engine/%OS-BIN%/hermes"

It worked, Thank you @sijav, you saved me.

@zenz found the problem, lol we put all those codes along side on exec...
I found a better solution,
change line 132 and 136 from:
"--reset-cache", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir,
to
"--reset-cache", "--entry-file", entryFile, "--bundle-output", enableHermes ? jsBundleFileDummy : jsBundleFile, "--assets-dest", resourcesDir,

change hermes command line to this
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFileTemp, *hermesFlags)
this way we create temp file and hermes files out of temp file in the right section and now after exec { ... } we can delete the file instead of moving the file
delete jsBundleFileTemp
I can see they have already implemented this on the master

Yes, I saw the the changes. But they seems broken something on release branch. my solution didn't work anymore. now it can pass the compilation, but cannot run. :(

When I use hermesCommand: "../node_modules/hermesvm/%OS-BIN%/hermes" it crashes on API < 19 but when i try to use latest version of hermes engine (hermesCommand: "../node_modules/hermes-engine/%OS-BIN%/hermes" ) to fix this, it crashes on all devices.
Any idea?

@zenz try get a logcat, most issues are mainly about the js itself, when there's a problem with JS you get a crash in release...

@sijav Wrong bytecode version, expected 59, but got 60.
Have to wait for next release now.

@zenz strange I don't have that problem what versions do you using? hermes-engine and react-native?

@sijav
With the newly creacted app:
"react-native": "0.60.4"
"hermes-engine": "0.1.1",

While I specific hermes-engine to 0.1.0, the app can compile and run again.

So, wait for next release.
I should also modify previous comments for workable solution.

I build apk successfully; but it crashes every time. App is installing but crashes each time when trying to open.
Untitled

Please add [email protected] before new release comes out.
yarn add --dev [email protected]

@zenz is the build successful ? I am also facing similar issue, after enabling Hermes with release build app crashes!

@zenz is the build successful ? I am also facing similar issue, after enabling Hermes with release build app crashes!

@affanhashone
Follow my steps in previous comments, specificaly use [email protected].
not the latest [email protected].
Yes, it can generate the apk and run without problem.

@zenz It works :) And I must Say, Its super fast now with hermes

@zenz It works but does not support API < 19 so I guess we should wait for the next release.
E/SoLoader: couldn't find DSO to load: libhermes.so caused by: dlopen failed: cannot locate symbol "posix_fallocate" referenced by "libhermes.so"...

@javadi69 I don't think they will support API < 19, because they already switch to Android X. many things changed.

Can anyone tell me steps? One by one? I tried all your comments and changed hermes engine to 0.1.0. But still app is not compiling. Can anyone prepare a proper steps in one comment which is workable for now?

@ErHarinderSingh
First add hermes-engine
yarn add --dev [email protected]
Then try to enable hermes in android/app/build.gradle with

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]

and then replace node_module/react-native/react.gradle with this file:
workable react.gradle file

I think this time you can make it to run with command
react-native run-android --variant release
or use
./gradlew assembleRelease to build your app on Windows.

it worked for me on Linux

Wow @zenz , @willholen @hungtrn75 , @sijav ... amazing ..super fast app. One of my app size was 40 mb and it is now 13 mb. It was opening in 2-3 seconds now it start up within a second. Also speed of tabs changing, wow it is amazing. Best days are coming for react-native. I think time is up for cordova and ionic. I am in love with React-Native now.

@ErHarinderSingh
First add hermes-engine
yarn add --dev [email protected]
Then try to enable hermes in android/app/build.gradle with

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]

and then replace node_module/react-native/react.gradle with this file:
workable react.gradle file

I think this time you can make it to run with command
react-native run-android --variant release
or use
./gradlew assembleRelease to build your app on Windows.

Booooooooooom!!!!!!!!!!!!!!!!!! Woww! I cant say anything! Worked for me ! 27MB to 12 MB! OMG , Performance and startup time is amazing

@ErHarinderSingh
First add hermes-engine
yarn add --dev [email protected]
Then try to enable hermes in android/app/build.gradle with

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]

and then replace node_module/react-native/react.gradle with this file:
workable react.gradle file

I think this time you can make it to run with command
react-native run-android --variant release
or use
./gradlew assembleRelease to build your app on Windows.

worked for me in release and debug .

FYI, you can use [email protected] rather than 0.1.0 if you also switch to the AARs from that package.

In the RN template project you can do this by changing the hermesPath in :

dependencies {
    [...]
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
    [...]
}

to

    def hermesPath = "../../node_modules/hermes-engine/android/";

so that both the bytecode compiler and the runtime interpreter come from [email protected].

If the bytecode compiler comes from [email protected] while the runtime interpreter comes from the older [email protected], then you'll get a "Wrong bytecode version" error.

Thank you @willholen, now my app can benefit from hermes and also runs on API <= 19

FYI, you can use [email protected] rather than 0.1.0 if you also switch to the AARs from that package.

In the RN template project you can do this by changing the hermesPath in :

dependencies {
    [...]
    def hermesPath = "../../node_modules/hermesvm/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
    [...]
}

to

    def hermesPath = "../../node_modules/hermes-engine/android/";

so that both the bytecode compiler and the runtime interpreter come from [email protected].

If the bytecode compiler comes from [email protected] while the runtime interpreter comes from the older [email protected], then you'll get a "Wrong bytecode version" error.

Already using that. Thanks @willholen :)

Add this if you have Proguard/R8 enabled to avoid a startup crash in Android:

-keep class com.facebook.hermes.unicode.* { *; }

@zenz构建成功了吗?在使用发布版本应用程序崩溃启用Hermes之后,我也面临着类似的问题!

@affanhashone
按照我之前评论中的步骤,具体使用[email protected]
不是最新的[email protected]
是的,它可以生成apk并运行没有问题。

when I use [email protected], I got this

@sijav错误的字节码版本,预计59,但得到60.
现在必须等待下一个版本。

And when I change to [email protected]
it works ,but app crashes
com.facebook.react.common.JavascriptException: undefined is not a function, js engine: hermes

any help?

@hejun041
First you need to guarantee your code runs well without hermes-engine activated.
Then
Please execute ./gradlew clean under the android folder first.
This avoids conflicts from previous compilation.

@ hejun041
首先,你需要保证你的代码运行良好,而不启用hermes-engine。
然后
请先在android文件夹下执行./gradlew clean。
这避免了以前编译的冲突。

如果您启用了Proguard / R8以避免Android中的启动崩溃,请添加此项:

-keep class com.facebook.hermes.unicode.* { *; }

It works,thanks all

Does anyone have a working basic setup because I tried everything I can read here and some people are saying it is working but for me I am still getting those same errors.

Does anyone have a working basic setup because I tried everything I can read here and some people are saying it is working but for me I am still getting those same errors.

@efleurine Please write down which way you have tried step by step, so that we can see where the problem existed.

Does anyone have a working basic setup because I tried everything I can read here and some people are saying it is working but for me I am still getting those same errors.

You can refer https://github.com/bhaskarGyan/react-native-memory-profile/tree/hermes

Still getting this error in 0.60.5 on Windows!!!
A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''

Still getting this error in 0.60.5 on Windows!!!
A problem occurred starting process 'command '..\..\node_modules\hermesvm\win64-bin\hermes''

As I commented, executed hermes needs to add "cmd /c" before the command line.

@zenz do you mean like so cmd/c ..\..\node_modules\hermesvm\win64-bin\hermes ? Sorry I don't quite get what you mean.

@usmansbk @willholen
open node_modulesreact-nativereact.gradle file. and find this line:
commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)
change it to this:
commandLine("cmd", "/", getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)

Of course for a complete update of this file, you should identify the system to chose a correct commandLine,:

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
    commandLine("cmd", "/", getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)
} else {
    commandLine(getHermesCommand(), "-emit-binary", "-out", jsBundleFile, jsBundleFile, *hermesFlags)
}

I don't want to fork a huge project and submit such a small mistake pull request.

I solved it (on Windows) by doing the following:

Add hermes-engine 0.1.1
yarn add [email protected]

Copy all react.gradle content from react-native master and replace your node_modules/react-native/react.gradle
https://github.com/facebook/react-native/blob/master/react.gradle

Apply the following changes to the updated react.gradle file:
https://github.com/facebook/react-native/pull/26080/commits/ee82182a70e5aa1841ca2418d0798c26c3ba93a1

Update the hermesPath in you android/app/build.gradle file
from: def hermesPath = "../../node_modules/hermesvm/android/";
to: def hermesPath = "../../node_modules/hermes-engine/android/";

Not sure if needed, but I also made sure to run android/gradlew.bat clean after the changes.

Notice that all these changes (except the pull request fix) is already in react-native master and used in react-native 0.61 RC

Also, since we are changing files in the node_modules folder, I'm using patch-package to create a patch file while awaiting updates to react-native to fix it.

Well I also have issues with Hermes
I've enabled it like this

dependencies {
    implementation project(':react-native-webview')
    implementation project(':react-native-fs')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-navigation')

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermesvm/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}
project.ext.react = [
        entryFile: "index.js",
        enableHermes: true,  // clean and rebuild if changing
        bundleAssetName: "index.android.bundle",
        bundleInAlpha: true,
        bundleInBeta: true
]

In my react native component I am having this

  const usingHermes = typeof HermesInternal === 'object' && HermesInternal !== null;
  console.log(typeof HermesInternal); // undefined

{!usingHermes ? (<Text style={styles.footer}>Engine: None</Text>) : (
            <View style={styles.engine}>
              <Text style={styles.footer}>Engine: Hermes</Text>
            </View>
          )}

react-native info

System:
    OS: macOS 10.14.6
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Memory: 42.12 MB / 8.00 GB
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.2 - ~/.nvm/versions/node/v10.16.2/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.9.0 - ~/.nvm/versions/node/v10.16.2/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 26, 28
      Build Tools: 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.4 AI-183.5429.30.34.5452501
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.5 => 0.60.5 
  npmGlobalPackages:
    react-native-clean-project: 3.2.4

It always outputs None on my component. Am I missing something?
And yes I cleaned my android build folder with ./gradlew clean

@ErHarinderSingh
First add hermes-engine
yarn add --dev [email protected]
Then try to enable hermes in android/app/build.gradle with

project.ext.react = [
    entryFile: "index.js",
    enableHermes: true,  // clean and rebuild if changing
    hermesCommand: "../../node_modules/hermes-engine/%OS-BIN%/hermes",
]

and then replace node_module/react-native/react.gradle with this file:
workable react.gradle file
I think this time you can make it to run with command
react-native run-android --variant release
or use
./gradlew assembleRelease to build your app on Windows.

it worked for me on Linux

Thank you soo its working to following these steps. thanks a lot

I'm really disapointed.
Today the RN 0.61.1 was released. but this patch still not there! We the programers who use Windows still need to apply the patch by ourselves. What a joke!

I'm really disapointed.
Today the RN 0.61.1 was released. but this patch still not there! We the programers who use Windows still need to apply the patch by ourselves. What a joke!

You are right bro. I am shocking why they have not added new working react.gradle file there with hermes release. We still have to change react.gradle file. If we have to add any package like gmaps etc; then react.gradle file changes again and we have to again modify it.

I'm really disapointed.
Today the RN 0.61.1 was released. but this patch still not there! We the programers who use Windows still need to apply the patch by ourselves. What a joke!

You are right bro. I am shocking why they have not added new working react.gradle file there with hermes release. We still have to change react.gradle file. If we have to add any package like gmaps etc; then react.gradle file changes again and we have to again modify it.

Yeah! I was hoping to find a way to prevent react.gradle from being overwritten every time I install a package. It's quite annoying. I don't believe they're not aware of this problem on Windows.

use hermes to compile the bundle file, I can get new bundle file, but with those error logs.

Is this means the hermes is not a complete engine for windows?

./node_modules/hermesvm/win64-bin/hermes -emit-binary -out index.bundle  C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle -O -output-source-map
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:13:147: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...Info,c=new Map,u={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return Pr...
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:23:2880: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...hrow",value:function(){return'undefined'!=typeof DebuggerInternal&&!0===DebuggerInternal.shouldPauseOnThrow}},{key...
                                                    ^~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:24063: warning: the variable "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in function "Lt"
...{}}}function Lt(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HO...
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:56221: warning: the variable "setTimeout" was not declared in function "Ni"
...BoundaryFound=!0,t.willRetry=!0);try{Ci(t)}catch(e){setTimeout(function(){throw e})}}function zi(e){var t=e.ref;if...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:22078: warning: the variable "clearTimeout" was not declared in function " 212#"
...etChildren(e._nativeTag,t),!1}var xt=setTimeout,St=clearTimeout,wt=/^(.*)[\\\/]/;function kt(e){var t="";do{e:swit...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:82109: warning: the variable "nativeFabricUIManager" was not declared in function " 247#"
...;try{r=t(this)}catch(e){}null!=r&&(r.canonical?nativeFabricUIManager.measure(r.node,pt(this,n)):c.measure(e(this),...
                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:100:795: warning: the variable "setImmediate" was not declared in function "h 6#"
..._72,t])):void n._72.push(t);h(n,t)}function h(n,u){setImmediate(function(){var c=1===n._65?u.onFulfilled:u.onRejec...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:109:177: warning: the variable "Worker" was not declared in function " 361#"
...ent),t={canUseDOM:n,canUseWorkers:'undefined'!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!...
                                                         ^~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:96: warning: the variable "fetch" was not declared in function " 423#"
...;var s=r(d[0]);s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},1...
                                                          ^~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:110: warning: the variable "Headers" was not declared in function " 423#"
...s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:126: warning: the variable "Request" was not declared in function " 423#"
...orts=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:143: warning: the variable "Response" was not declared in function " 423#"
...fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1539: warning: the variable "FileReader" was not declared in function "p 13#"
...or=function(){n(t.error)}})}function p(t){var o=new FileReader,n=l(o);return o.readAsArrayBuffer(t),n}function b(t...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1973: warning: the variable "Blob" was not declared in function " 432#"
...dyInit=t,t?'string'==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData...
                                                          ^~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2034: warning: the variable "FormData" was not declared in function " 432#"
...totype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.se...
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2107: warning: the variable "URLSearchParams" was not declared in function " 432#"
...ototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toSt...
                                                     ^~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:6805: warning: the variable "XMLHttpRequest" was not declared in function " 439#"
...t.DOMException('Aborted','AbortError'));var y=new XMLHttpRequest;function l(){y.abort()}y.onload=function(){var t,...
                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:280: warning:...meout?clearTimeout:void 0,c="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,f="function"==ty...

                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:352: warning:
 the variable "cancelAnimationFrame" was not declared in function " 538#"
...uestAnimationFrame:void 0,f="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0,p=void 0,v=void 0;...

                                                  ^~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:527: warning:
 the variable "performance" was not declared in function " 538#"
...{f(p),n(e.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var y=perform...

                                                       ^~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:733: warning:
 the variable "MessageChannel" was not declared in function " 538#"
...if("undefined"==typeof window||"function"!=typeof MessageChannel){var w=null,_=function(n){if(null!==w)try{w(n)}fi...

                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:267:2395: warning
: the variable "clearImmediate" was not declared in function " 1025#"
...Transition:'fade'},f._updatePropsStack=function(){clearImmediate(f._updateImmediate),f._updateImmediate=setImmedia...

                                                     ^~~~~~~~~~~~~~

getting those error logs on mac too.

The error still occurs on Windows even after upgrading to 0.61.1.

image

The PR fix was merged two days ago: https://github.com/facebook/react-native/pull/26556. Hopefully, we will see it in the next update.

I am using 0.61.2, still I am getting same error of hermes in window...

I'm still seeing the same error as well in-spite of following the steps mentioned above

The day my Hermes config works, I will pay myself 2 ice creams.

I am using 0.61.2, still I am getting same error of hermes in window...

It works in ubuntu and not working in window. If I need to reduce the size of apk using hermes, then I need to used ubuntu for that

@willholen
Is this a super bug?
Is something wrong with the patch we've been using?
Should Windows users migrate to a different OS?
Why won't they fix this bug? Modifying the react.gradle file is really annoying.

Running ./gradlew bundleRelease is giving many similar kind of errors with different variables

/home/ubuntu/X/Y/App/android/app/build/generated/assets/react/release/index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
__d(function(g,r,i,a,m,e,d){'use strict';var n=r(d[0])(r(d[1])),t=r(d[2]),o=r(d[3]),s=new Map,c={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return Promise.resolve(!1)},isInvertColorsEnabled:function(){return Promise.resolve(!1)},isReduceMotionEnabled:function(){return new Promise(function(t,o){n.default?n.default.isReduceMotionEnabled(t):o(!1)})},isReduceTransparencyEnabled:function(){return Promise.resolve(!1)},isScreenReaderEnabled:function(){return new Promise(function(t,o){n.default?n.default.isTouchExplorationEnabled(t):o(!1)})},get fetch(){return this.isScreenReaderEnabled},addEventListener:function(n,o){var c;'change'===n||'screenReaderChanged'===n?c=t.addListener("touchExplorationDidChange",function(n){o(n)}):'reduceMotionChanged'===n&&(c=t.addListener("reduceMotionDidChange",function(n){o(n)})),s.set(o,c)},removeEventListener:function(n,t){var o=s.get(t);o&&(o.remove(),s.delete(t))},setAccessibilityFocus:function(n){o.sendAccessibilityEvent(n,o.getConstants().AccessibilityEventTypes.typeViewFocused)},announceForAccessibility:function(t){n.default&&n.default.announceForAccessibility(t)}};m.exports=c},7,[1,8,30,43]);

Eventhough an app.abb is being created app crashes while running.
However react-native run-android --variant=release works fine.
I am using Linux ( Ubuntu ) and facing the problem :(

i am using 0.60.5 still facing the issue :(
@andreasbergqvist fix worked

Yeah, it was merged to master but that was after the 0.61-branch was cut, so it hasn't made it in a release there. I just added the commit to the request for cherry-picks on 0.61 after seeing @LuigiMaestrelli mention it.

I just checked on 0.62-stable and it's on there https://github.com/facebook/react-native/blob/0.62-stable/react.gradle#L153 so whenever 0.62.0 comes out (it's really close but is blocked on CI failures if anyone wants to lend a hand...) it will have it as well.

Until then get yourself some patch-package goodness - makes incorporating known fixes in old releases super easy and reliable across all installs of your project :-). Cheers

use hermes to compile the bundle file, I can get new bundle file, but with those error logs.
Is this means the hermes is not a complete engine for windows?

./node_modules/hermesvm/win64-bin/hermes -emit-binary -out index.bundle  C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle -O -output-source-map
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:13:147: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...Info,c=new Map,u={isBoldTextEnabled:function(){return Promise.resolve(!1)},isGrayscaleEnabled:function(){return Pr...
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:23:2880: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...hrow",value:function(){return'undefined'!=typeof DebuggerInternal&&!0===DebuggerInternal.shouldPauseOnThrow}},{key...
                                                    ^~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:24063: warning: the variable "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in function "Lt"
...{}}}function Lt(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HO...
                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:56221: warning: the variable "setTimeout" was not declared in function "Ni"
...BoundaryFound=!0,t.willRetry=!0);try{Ci(t)}catch(e){setTimeout(function(){throw e})}}function zi(e){var t=e.ref;if...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:22078: warning: the variable "clearTimeout" was not declared in function " 212#"
...etChildren(e._nativeTag,t),!1}var xt=setTimeout,St=clearTimeout,wt=/^(.*)[\\\/]/;function kt(e){var t="";do{e:swit...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:82:82109: warning: the variable "nativeFabricUIManager" was not declared in function " 247#"
...;try{r=t(this)}catch(e){}null!=r&&(r.canonical?nativeFabricUIManager.measure(r.node,pt(this,n)):c.measure(e(this),...
                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:100:795: warning: the variable "setImmediate" was not declared in function "h 6#"
..._72,t])):void n._72.push(t);h(n,t)}function h(n,u){setImmediate(function(){var c=1===n._65?u.onFulfilled:u.onRejec...
                                                      ^~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:109:177: warning: the variable "Worker" was not declared in function " 361#"
...ent),t={canUseDOM:n,canUseWorkers:'undefined'!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!...
                                                         ^~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:96: warning: the variable "fetch" was not declared in function " 423#"
...;var s=r(d[0]);s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},1...
                                                          ^~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:110: warning: the variable "Headers" was not declared in function " 423#"
...s&&s.fetch?m.exports=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:126: warning: the variable "Request" was not declared in function " 423#"
...orts=s:m.exports={fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                         ^~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:122:143: warning: the variable "Response" was not declared in function " 423#"
...fetch:fetch,Headers:Headers,Request:Request,Response:Response}},116,[117]);
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1539: warning: the variable "FileReader" was not declared in function "p 13#"
...or=function(){n(t.error)}})}function p(t){var o=new FileReader,n=l(o);return o.readAsArrayBuffer(t),n}function b(t...
                                                       ^~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:1973: warning: the variable "Blob" was not declared in function " 432#"
...dyInit=t,t?'string'==typeof t?this._bodyText=t:o.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:o.formData...
                                                          ^~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2034: warning: the variable "FormData" was not declared in function " 432#"
...totype.isPrototypeOf(t)?this._bodyBlob=t:o.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:o.se...
                                                        ^~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:2107: warning: the variable "URLSearchParams" was not declared in function " 432#"
...ototypeOf(t)?this._bodyFormData=t:o.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toSt...
                                                     ^~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:123:6805: warning: the variable "XMLHttpRequest" was not declared in function " 439#"
...t.DOMException('Aborted','AbortError'));var y=new XMLHttpRequest;function l(){y.abort()}y.onload=function(){var t,...
                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:280: warning:...meout?clearTimeout:void 0,c="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,f="function"==ty...

                                                  ^~~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:352: warning:
 the variable "cancelAnimationFrame" was not declared in function " 538#"
...uestAnimationFrame:void 0,f="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0,p=void 0,v=void 0;...

                                                  ^~~~~~~~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:527: warning:
 the variable "performance" was not declared in function " 538#"
...{f(p),n(e.unstable_now())},100)}if("object"==typeof performance&&"function"==typeof performance.now){var y=perform...

                                                       ^~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:151:733: warning:
 the variable "MessageChannel" was not declared in function " 538#"
...if("undefined"==typeof window||"function"!=typeof MessageChannel){var w=null,_=function(n){if(null!==w)try{w(n)}fi...

                                                     ^~~~~~~~~~~~~~
C:\Users\zenz\programs\test_app\android\app\build\generated\assets\react\release\index.android.bundle:267:2395: warning
: the variable "clearImmediate" was not declared in function " 1025#"
...Transition:'fade'},f._updatePropsStack=function(){clearImmediate(f._updateImmediate),f._updateImmediate=setImmedia...

                                                     ^~~~~~~~~~~~~~

getting those error logs on mac too.

@zenz How did this got resolved on mac?

The same issue on osx-bin:

I got error:
A problem occurred starting process 'command '../../node_modules/hermesvm/osx-bin/hermes''
React Native versioin:0.60.3

How did you resolve it?

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings