I am trying to build my react-native project with travis ci using this command:
script:
- npm install -g npx && cd android && sudo chmod +x gradlew && sudo ./gradlew assembleRelease#3
However, my build fails with the following error: Cannot run program "npx": error=2, No such file or directory
My full config if as follows:
language: android
before_install: #1.1
- nvm install 10
- node --version
install: #1.2
- npm install
android: #1.3
components:
- build-tools-23.0.1
- android-23
- extra-android-m2repository
- extra-google-google_play_services
- extra-google-m2repository
- addon-google_apis-google-16
script:
- npm install -g npx && cd android && sudo chmod +x gradlew && sudo ./gradlew assembleRelease#3
deploy: # mostly generated by `> travis deploy releases`
skip_cleanup: true
It seems as though the build file is unable to find npx even though I have installed globally with npm. In the native_modules.gradle files where the errors, the error line is as follows:
def npx = Os.isFamily(Os.FAMILY_WINDOWS) ? "npx.cmd" : "npx"
Here is a call stack where the error occurs:
Welcome to Gradle 5.5!
1776
1777
Here are the highlights of this release:
1778
- Kickstart Gradle plugin development with gradle init
1779
- Distribute organization-wide Gradle properties in custom Gradle distributions
1780
- Transform dependency artifacts on resolution
1781
1782
For more details see https://docs.gradle.org/5.5/release-notes.html
1783
1784
Starting a Gradle Daemon (subsequent builds will be faster)
1785
1786
1787
> Starting Daemon<-------------> 0% INITIALIZING [21ms]<-------------> 0% INITIALIZING [121ms]> Evaluating settings<-------------> 0% INITIALIZING [221ms]<-------------> 0% INITIALIZING [321ms]<-------------> 0% INITIALIZING [421ms]<-------------> 0% INITIALIZING [521ms]<-------------> 0% INITIALIZING [621ms]<-------------> 0% INITIALIZING [721ms]<-------------> 0% INITIALIZING [822ms]> Evaluating settings > Compiling /home/travis/build/daniel-sudz/bbox-mobile/an<-------------> 0% INITIALIZING [921ms]<-------------> 0% INITIALIZING [1s]> Evaluating settings> Evaluating settings > Compiling /home/travis/build/daniel-sudz/bbox-mobile/no> Evaluating settingsmand from 'null' directory failed.
1788
1789
FAILURE: Build failed with an exception.
1790
1791
* Where:
1792
Script '/home/travis/build/daniel-sudz/bbox-mobile/node_modules/@react-native-community/cli-platform-android/native_modules.gradle' line: 154
1793
1794
* What went wrong:
1795
A problem occurred evaluating script.
1796
> Cannot run program "npx": error=2, No such file or directory
Note: the build occurs on ubuntu
Any ideas on what the solution may be?