createBundleReleaseJsAndAssets FAILED
Description
I suddenly got this error while building my project. I used it for 2 weeks and there was no problem. I didn't understand.
Steps to reproduce
- install application "cd android && ./gradlew bundleRelease"
React Native Version
0.81.4
Affected Platforms
Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 15.4.1
CPU: (8) arm64 Apple M1 Pro
Memory: 131.30 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.4
path: /Users/sahinboga/.nvm/versions/node/v20.19.4/bin/node
Yarn:
version: 1.22.21
path: /opt/homebrew/bin/yarn
npm:
version: 10.8.2
path: /Users/sahinboga/.nvm/versions/node/v20.19.4/bin/npm
Watchman:
version: 2025.05.19.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /Users/sahinboga/.gems/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "25"
- "26"
- "28"
- "30"
- "31"
- "33"
- "34"
- "35"
- "36"
Build Tools:
- 30.0.3
- 31.0.0
- 33.0.0
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
System Images:
- android-36 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9787799
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.9
path: /usr/bin/javac
Ruby:
version: 3.4.4
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.0
wanted: 19.1.0
react-native:
installed: 0.81.4
wanted: 0.81.4
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
Stacktrace or Logs
> Task :app:createBundleReleaseJsAndAssets FAILED
error configs.toReversed is not a function.
TypeError: configs.toReversed is not a function
at mergeConfig (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/metro-config/src/loadConfig.js:179:35)
at Object.getDefaultConfig (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/@react-native/metro-config/dist/index.js:97:39)
at loadMetroConfig (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/@react-native/community-cli-plugin/dist/utils/loadMetroConfig.js:66:39)
at Object.buildBundle [as func] (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/@react-native/community-cli-plugin/dist/commands/bundle/buildBundle.js:22:53)
at Command.handleAction (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/@react-native-community/cli/build/index.js:139:23)
at Command.listener [as _actionHandler] (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/commander/lib/command.js:482:17)
at /Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/commander/lib/command.js:1283:65
at Command._chainOrCall (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/commander/lib/command.js:1177:12)
at Command._parseCommand (/Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/commander/lib/command.js:1283:27)
at /Users/sahinboga/Documents/GitHub/YayincilikOgretmen/node_modules/commander/lib/command.js:1081:27
MANDATORY Reproducer
https://github.com/sahinboga
Screenshots and Videos
No response
[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Reproducers are mandatory and we can accept only one of those as a valid reproducer:
- For majority of bugs: send us a Pull Request with the RNTesterPlayground.js edited to reproduce your bug.
- If your bug is UI related: a Snack
- If your bug is build/upgrade related: a project using our Reproducer Template
You can read more about about it on our website: How to report a bug.
I had the same error today. I needed to sync my project with Gradle files in Android Studio. I encountered some errors, but after fixing them, I simply ran a "clean project" in Android Studio and synced the project with Gradle files again. After that, everything worked fine.
I think it was a temporary issue, when I tried it a few hours later I was able to get the correct build.
For me, the issue occurred because I still had an .xcode.env.local that pointed to an old version of Node.
In my case, I was using nvm(which automatically switches Node versions in each workspace), and my Node version was lower than the one that supports ES2023 (available in Node v20 and above).
So, I updated the default Node version in nvm to v22.
I got this error, solved by changing the node version to 20.16.0. Issue resolved.
the same problem here, in Apple M4, only macos...
I was having the same issue and in my case it was also due to Node versions, I had to upgrade it
Hi, adding the following to android/app/build.gradle solved the problem.
// Get Node.js path from nvm
def getNodePath() {
try {
def nvmrcFile = new File(projectDir, "../../.nvmrc")
if (nvmrcFile.exists()) {
def nodeVersion = nvmrcFile.text.trim()
def homeDir = System.getProperty("user.home")
def nodePath = "${homeDir}/.nvm/versions/node/${nodeVersion}/bin/node"
if (new File(nodePath).exists()) {
return nodePath
}
}
} catch (Exception e) {
// Ignore errors
}
// Fallback to system node
return "node"
}
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
nodeExecutableAndArgs = [getNodePath()]
This was really a frustrating issue.
I spent 2 days in finding the solution.
There's a file named as .xcode.env.local in ios folder.
Inside it , you would have something like this
export NODE_BINARY=/Users/codedecode/.nvm/versions/node/v18.19.0/bin/node
So you just need to change this version to greater than 20
I used
export NODE_BINARY=/Users/codedecode/.nvm/versions/node/v20.19.5/bin/node
I have the same error, but the error is
Task :app:createBundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':app:createBundleReleaseJsAndAssets' (type 'BundleHermesCTask').
- In plugin 'com.facebook.react' type 'com.facebook.react.tasks.BundleHermesCTask' property 'cliFile' file '/Users/williamchan/Documents/gk_research_app_staging/android/app' is not a file.
Reason: Expected an input to be a file but it was a directory.
Possible solutions:
1. Use a file as an input.
2. Declare the input as a directory instead.
For more information, please refer to https://docs.gradle.org/8.14.3/userguide/validation_problems.html#unexpected_input_file_type in the Gradle documentation.
* Try:
> Use a file as an input
> Declare the input as a directory instead
> Run with --scan to get full insights.
Do anybody have idea about it?
I have the same error, but the error is
Task :app:createBundleReleaseJsAndAssets FAILED FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':app:createBundleReleaseJsAndAssets' (type 'BundleHermesCTask'). - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.BundleHermesCTask' property 'cliFile' file '/Users/williamchan/Documents/gk_research_app_staging/android/app' is not a file. Reason: Expected an input to be a file but it was a directory. Possible solutions: 1. Use a file as an input. 2. Declare the input as a directory instead. For more information, please refer to https://docs.gradle.org/8.14.3/userguide/validation_problems.html#unexpected_input_file_type in the Gradle documentation. * Try: > Use a file as an input > Declare the input as a directory instead > Run with --scan to get full insights.Do anybody have idea about it?
I think this must be related to cliFile path in your android -> app -> build.gradle Either completely remove that reference or change it to node_modules/react-native/cli.js
Hopefully it would solve your bug
I have the same error, but the error is
Task :app:createBundleReleaseJsAndAssets FAILED FAILURE: Build failed with an exception. * What went wrong: A problem was found with the configuration of task ':app:createBundleReleaseJsAndAssets' (type 'BundleHermesCTask'). - In plugin 'com.facebook.react' type 'com.facebook.react.tasks.BundleHermesCTask' property 'cliFile' file '/Users/williamchan/Documents/gk_research_app_staging/android/app' is not a file. Reason: Expected an input to be a file but it was a directory. Possible solutions: 1. Use a file as an input. 2. Declare the input as a directory instead. For more information, please refer to https://docs.gradle.org/8.14.3/userguide/validation_problems.html#unexpected_input_file_type in the Gradle documentation. * Try: > Use a file as an input > Declare the input as a directory instead > Run with --scan to get full insights.Do anybody have idea about it?
I think this must be related to cliFile path in your android -> app -> build.gradle Either completely remove that reference or change it to node_modules/react-native/cli.js
Hopefully it would solve your bug
You really saved my day!!! I realized that @expo/cli is missing (as I use expo). After installing it, the problem is fixed.
// Added by install-expo-modules
entryFile = file(["node", "-e", "require('expo/scripts/resolveAppEntry')", rootDir.getAbsoluteFile().getParentFile().getAbsolutePath(), "android", "absolute"].execute(null, rootDir).text.trim())
cliFile = new File(["node", "--print", "require.resolve('@expo/cli')"].execute(null, rootDir).text.trim())
bundleCommand = "export:embed"
After updated the node to v20.19.6 and restart the mac it works
node -v v20.19.4 not working
node -v v20.19.4 not working
Can you show me your .xcode.env.local file?? Inside iOS folder..
node -v v20.19.4 not working
Can you show me your .xcode.env.local file?? Inside iOS folder..
export NODE_BINARY=$(command -v node)
Hi, I had the same error in my case it was the Node version I changed from 18 to 22 and it worked.