-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 build release (hermes enable) #34116
Comments
I faced the same issue with a new application created with project.ext.react = [
enableHermes: true, // clean and rebuild if changing
hermesCommand: '../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc'
]
I hope this helps 🙂 |
@cervisebas were you able to build successfully on windows 10 i have been having error with my build on windows checkout the issue here #34084 |
Thanks for sharing this @JoseLion That sounds like a potential bug though. Lines 117 to 124 in 71e8921
I wonder why you had to specify this value again. |
@cortinico good point! I think I found the problem, and now it makes sense that it's only affecting Windows users. The I think a simple solution could be to have a variable with the correct binary file depending on the OS: def hermescBin = Os.isFamily(Os.FAMILY_WINDOWS) ? 'hermesc.exe' : 'hermesc' I'll be happy to open a PR with this change if you agree it's a good approach 🙂 |
I can confirm the @JoseLion's fix, adding ".exe" in the file path works: // 3. If the react-native contains a pre-built hermesc, use it.
def hermescBin = Os.isFamily(Os.FAMILY_WINDOWS) ? 'hermesc.exe' : 'hermesc'
def prebuiltHermesPath = ("node_modules/react-native/sdks/hermesc/%OS-BIN%/" + hermescBin)
.replaceAll("%OS-BIN%", getHermesOSBin())
.replace('/' as char, File.separatorChar); Thanks @JoseLion! |
I opened PR #34151 with this fix. I hope this helps 🎉 |
Added changes to my local
Similar when running
|
@nibblesnbits I think the path for I can include a fix in the open PR, but I need some help to confirm if the proposed solution fixes the issue since I'm not currently using the new architecture 😅 |
…34151) Summary: Resolves #34116. In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users Pull Request resolved: #34151 Test Plan: ### Reproduce Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can: 1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine 2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes) 3. Clean the build folder: `cd android && ./gradlew clean` 4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets` 5. The build fails with the following error: ```shell Execution failed for task ':app:bundleReleaseJsAndAssets'. > java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc ``` ### Test the changes Follow the same steps above using the fix on this PR and the error should disappear 🙂 Reviewed By: NickGerleman Differential Revision: D37755468 Pulled By: cortinico fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
…acebook#34151) Summary: Resolves facebook#34116. In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users Pull Request resolved: facebook#34151 Test Plan: ### Reproduce Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can: 1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine 2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes) 3. Clean the build folder: `cd android && ./gradlew clean` 4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets` 5. The build fails with the following error: ```shell Execution failed for task ':app:bundleReleaseJsAndAssets'. > java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc ``` ### Test the changes Follow the same steps above using the fix on this PR and the error should disappear 🙂 Reviewed By: NickGerleman Differential Revision: D37755468 Pulled By: cortinico fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
…acebook#34151) Summary: Resolves facebook#34116. In a nutshell, the problem was a missing `.exe` extension on the `hermesc` binary path when running on Windows OS. The missing extension causes the method `.exists()` of the File instance to always return false, so none of the conditions ever met and an error was thrown whenever a release build with Hermes enabled was run on Windows. More details can be found in the comments on the above issues. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [Android] [Fixed] - Fix error of release builds with Hermes enabled for Windows users Pull Request resolved: facebook#34151 Test Plan: ### Reproduce Changes on Gradle scrips are better tested on an actual application. To reproduce the issue you can: 1. Create or reuse a React Native application with version `v0.69.1` on a Windows machine 2. Enable Hermes on Android following the steps on the [documentation](https://reactnative.dev/docs/hermes#enabling-hermes) 3. Clean the build folder: `cd android && ./gradlew clean` 4. Bundle the JS and assets for a release version: `./gradlew bundleReleaseJsAndAssets` 5. The build fails with the following error: ```shell Execution failed for task ':app:bundleReleaseJsAndAssets'. > java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc ``` ### Test the changes Follow the same steps above using the fix on this PR and the error should disappear 🙂 Reviewed By: NickGerleman Differential Revision: D37755468 Pulled By: cortinico fbshipit-source-id: 2ad0ced583555b907259df116f64a45da6d153f3
add this in dependencies def hermesPath = "../../node_modules/hermes-engine/android/" inside if section like this
|
…ocation. Please set project.ext.react.hermesCommand to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc". Se encontro en facebook/react-native#34116
Description
Console out:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\cervi\Desktop\Escuela\proyecto-asistencia@Reset2\TecnicaDigital\node_modules\react-native\react.gradle' line: 126
What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
Version
0.69.1
Output of
npx react-native info
System:
OS: Windows 10 10.0.22000
CPU: (4) x64 Intel(R) Core(TM) i3-7020U CPU @ 2.30GHz
Memory: 1.92 GB / 7.88 GB
Binaries:
Node: 16.13.1 - ~\AppData\Local\Temp\yarn--1656711531736-0.4762878003872508\node.CMD
Yarn: 1.22.19 - ~\AppData\Local\Temp\yarn--1656711531736-0.4762878003872508\yarn.CMD
npm: 8.12.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 28, 29, 30, 31, 32
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
System Images: android-24 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom
Android NDK: 23.1.7779620
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.10240.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401
Visual Studio: 15.9.28307.1919 (Visual Studio Community 2017), 16.11.32407.337 (Visual Studio Community 2019)
Languages:
Java: 11.0.13 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.69.1 => 0.69.1
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
.
Snack, code example, screenshot, or link to a repository
.
The text was updated successfully, but these errors were encountered: