Android version of my React Native app fails to build in the Visual Studio App Center after cloning from my BitBucket repo. Always fails with:
:app:bundleReleaseJsAndAssets
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ You are currently running io.js v6.14.4. โ
โ โ
โ React Native runs on Node 8.3 or newer. There are several ways to โ
โ upgrade Node.js depending on your preference. โ
โ โ
โ nvm: nvm install 8.3 --reinstall-packages-from=node โ
โ Homebrew: brew update && brew upgrade node โ
โ Installer: download from https://nodejs.org/ โ
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
:app:bundleReleaseJsAndAssets FAILED
Please list the steps used to reproduce your issue.
"appcenter": "^1.8.1",
"appcenter-analytics": "^1.8.1",
"appcenter-crashes": "^1.8.1",
"axios": "^0.18.0",
"react": "16.5.1",
"react-native": "0.57",
"react-native-linear-gradient": "^2.4.2",
"react-native-loading-spinner-overlay": "^0.5.2",
"react-native-responsive-screen": "^1.1.9",
"react-native-snap-carousel": "^3.7.4",
"react-native-vector-icons": "^5.0.0",
"react-navigation": "^2.13.0",
"react-redux": "^5.0.7",
"redux": "^4.0.0",
"redux-saga": "^0.16.0"
react-native info System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Memory: 65.05 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.11.4 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 4.6.1 - /usr/local/bin/npm
SDKs:
iOS SDK:
Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
Android SDK:
Build Tools: 23.0.1, 27.0.3, 28.0.2
API Levels: 23, 25, 27, 28
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.1 => 16.5.1
react-native: 0.57 => 0.57.0
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
pod --version...
:app:checkReleaseManifest
:app:generateReleaseBuildConfig
:app:prepareLintJar
:app:mainApkListPersistenceRelease
:app:bundleReleaseJsAndAssets
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ You are currently running io.js v6.14.4. โ
โ โ
โ React Native runs on Node 8.3 or newer. There are several ways to โ
โ upgrade Node.js depending on your preference. โ
โ โ
โ nvm: nvm install 8.3 --reinstall-packages-from=node โ
โ Homebrew: brew update && brew upgrade node โ
โ Installer: download from https://nodejs.org/ โ
โ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
:app:bundleReleaseJsAndAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'node'' finished with non-zero exit value 1
* 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 52s
17 actionable tasks: 14 executed, 3 up-to-date
Error: /Users/vsts/agent/2.140.0/work/1/s/android/gradlew failed with return code: 1
at ChildProcess.<anonymous> (/Users/vsts/agent/2.140.0/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:886:16)
at Socket.<anonymous> (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:497:12)
##[error]Error: /Users/vsts/agent/2.140.0/work/1/s/android/gradlew failed with return code: 1
##[section]Finishing: Gradle Task
##[section]Starting: Checkout
==============================================================================
Task : Get sources
Description : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.
Version : 1.0.0
Author : Microsoft
Help : [More Information](https://go.microsoft.com/fwlink/?LinkId=798199)
==============================================================================
Cleaning any cached credential from repository: cpam_mobile_th (ExternalGit)
##[section]Finishing: Checkout
##[section]Finishing: Job
Am I missing something or doing something wrong? I'm assuming App Center supports React Native 0.57 based on this post here but if that's not the case do I have any recourse to get this working?
Any and all help is much appreciated!
Hi @sabun123, this is an issue with the App Center build backend. Could you please open a ticket on intercom from the appcenter.ms site with all the information you included here? Someone will get in touch with you soon. Thanks for being so detailed!
Thanks for pointing me to the intercom @jwallra!
For anyone else facing this issue, you may refer to this link here.
Basically, create a Post-Clone script file and save it in the same directory as your package.json. Name this file appcenter-post-clone.sh.
In this file, enter the following:
#!/usr/bin/env bash
set -ex
brew uninstall node@6
NODE_VERSION="8.11.4"
curl "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}.pkg" > "$HOME/Downloads/node-installer.pkg"
sudo installer -store -pkg "$HOME/Downloads/node-installer.pkg" -target "/"
Change the NODE_VERSION from 8.11.4 to whatever number you need.
Save it. Then commit it to your repository. Then inside Microsoft's App Center, your Build Configuration should list "Post-Clone" under build scripts now and it should be ticked.
IMPORTANT! Click on that grey SAVE button (I did it a few times for good measure). Then build, and you should be good!
Initially I had this post-clone script up there already, but even after the App Center was showing it in the Build Configuration with a tick, it was not using it during the build process. This meant I was stuck on an older Node version, when what I needed was Node 8.3 or newer. After clicking Save a few times, the App Center finally picked it up and used it during the build process.
Hope that helps anyone else who runs into this!
P.S: Issue here is simply that my project required a newer specific version of Node than what App Center's build backend was using. Thus build fails.
Most helpful comment
Thanks for pointing me to the intercom @jwallra!
For anyone else facing this issue, you may refer to this link here.
Basically, create a Post-Clone script file and save it in the same directory as your package.json. Name this file appcenter-post-clone.sh.
In this file, enter the following:
Change the NODE_VERSION from 8.11.4 to whatever number you need.
Save it. Then commit it to your repository. Then inside Microsoft's App Center, your Build Configuration should list "Post-Clone" under build scripts now and it should be ticked.
IMPORTANT! Click on that grey SAVE button (I did it a few times for good measure). Then build, and you should be good!
Initially I had this post-clone script up there already, but even after the App Center was showing it in the Build Configuration with a tick, it was not using it during the build process. This meant I was stuck on an older Node version, when what I needed was Node 8.3 or newer. After clicking Save a few times, the App Center finally picked it up and used it during the build process.
Hope that helps anyone else who runs into this!
P.S: Issue here is simply that my project required a newer specific version of Node than what App Center's build backend was using. Thus build fails.