Skip to content
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

npx cordova freezes on Linux Machines #1054

Open
the-bay-kay opened this issue Feb 21, 2024 · 0 comments
Open

npx cordova freezes on Linux Machines #1054

the-bay-kay opened this issue Feb 21, 2024 · 0 comments

Comments

@the-bay-kay
Copy link

the-bay-kay commented Feb 21, 2024

Background

  • Goal: build e-mission-phone to an Android .apk.
  • Because I do not have a personal Mac, and NREL doesn't allow the installation of the Android SDK on lab machines, I'm looking to build on my person Linux machine
    • When running setup for iOS development on my Mac, this issue does not occur.
  • Linux distributions I have tested so far:
    • NixOS (Hardware)
    • Fedora 38 (Running on hardware)
    • Ubuntu 23 (Running in a VM via Gnome Boxes)
  • The correct version of openjdk, nmv, and android-studio have been installed.
    • Android SDK was installed per Android's instructions, not the e-mission script. To the best of my understanding, the issue doesn't involve the SDK -- but the more context, the better!

The Issue

Following our build instructions for android (link), the build process fails when running bash setup/setup_android_native.sh. When running this script, it freezes at this point:

# .... More output above
added 76 packages, removed 256 packages, changed 1 package, and audited 2435 packages in 30s

177 packages are looking for funding
  run `npm fund` for details

54 vulnerabilities (2 low, 21 moderate, 17 high, 14 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.
hack to make the local cordova fail on error

Going into the setup scripts (link), each test of this script seems to freeze upon the execution of npx cordova prepare. Indeed, after testing, it seems that any variation of npx cordova freezes at this point in the Linux install. This appears to be unusual behavior, as this command is run in both iOS and Android setup - and the MacOS builds I have done have not had this issue. Furthermore, running any version of npx cordova on MacOS executes as expected.

Working Theories

So far, I know that:

  • This issue occurs on Linux Machines, but not MacOS
  • This is likely not an issue with the Android build specifically, as both the package install and error occur within setup_shared_native.sh
  • The issue appears to be with npx cordova, because:
    • npx cordova executes as normal on MacOS, and
    • Executing cordova via NPM has frozen across Linux distrobutions
  • Running other variations of the npx command on Linux appear to work as intended
  • Doing a fresh install of and execution of cordova (e.x., going to a new directory and running npm install cordova@11.1.0; npx cordova prepare on Linux runs as intended.
    • This seems to suggest that the error occurs somewhere within our setup process

Given the information above, all signs seem to point to an error with how we install the cordova packages: specifically, cordova@11.1.0 Running npm list | grep cordova after the freeze occurs results in the following outputs:

├── @havesource/cordova-plugin-push@4.0.0-dev.0 (git+ssh://git@github.com/havesource/cordova-plugin-push.git#c3fb5b894afe17a05e21be135961f5831bafb1e0)
├── cordova-android@12.0.0
├── cordova-custom-config@5.1.1
├── cordova-ios@6.2.0
├── cordova-plugin-advanced-http@3.3.1
├── cordova-plugin-androidx-adapter@1.1.3
├── cordova-plugin-app-version@0.1.14
├── cordova-plugin-bluetooth-classic-serial-port@0.9.13
├── cordova-plugin-customurlscheme@5.0.2
├── cordova-plugin-device@2.1.0
├── cordova-plugin-em-datacollection@1.7.8 (git+ssh://git@github.com/e-mission/e-mission-data-collection.git#0ef1cd30fa305090eabcbd199d8f2d6be323f35a)
├── cordova-plugin-em-opcodeauth@1.7.1 (git+ssh://git@github.com/e-mission/cordova-jwt-auth.git#141cf3c378da0563ba1f868dca2341ce71dd98ba)
├── cordova-plugin-em-server-communication@1.2.5 (git+ssh://git@github.com/e-mission/cordova-server-communication.git#72d3a4e73003e99e952f965649ef3ce0ac191a84)
├── cordova-plugin-em-serversync@1.3.1 (git+ssh://git@github.com/e-mission/cordova-server-sync.git#01c4e4cb7cd9bfd1b86f451d184ae187139ab7e2)
├── cordova-plugin-em-settings@1.2.2 (git+ssh://git@github.com/e-mission/cordova-connection-settings.git#df2e225b994cbd0f13d0c21b1e79bf219f8c1a13)
├── cordova-plugin-em-unifiedlogger@1.3.6 (git+ssh://git@github.com/e-mission/cordova-unified-logger.git#49611d64b11e9ff2ec98c0517de227db0c13db69)
├── cordova-plugin-em-usercache@1.1.4 (git+ssh://git@github.com/e-mission/cordova-usercache.git#6b6d85506a9cddb59f2ba84ccd131c39b0839633)
├── cordova-plugin-email-composer@0.10.1 (git+ssh://git@github.com/katzer/cordova-plugin-email-composer.git#5b342254deeda1bf836ae309ae2da069b1d58f98)
├── cordova-plugin-file@8.0.0
├── cordova-plugin-inappbrowser@5.0.0
├── cordova-plugin-ionic-keyboard@2.2.0
├── cordova-plugin-ionic-webview@5.0.0
├── cordova-plugin-local-notification-12@0.1.4-fix-android-action (git+ssh://git@github.com/e-mission/cordova-plugin-local-notification-12.git#86195b9781d1e0ef6dc20770651b919c72ef8ea6)
├── cordova-plugin-x-socialsharing@6.0.4
├── cordova@11.1.0

At a glance (and when cross referenced with the same command, run on MacOS), nothing seems missing or out of place.

Finally, I have found very little information on this issue online. Most of the threads I've found relate to either npx freezing (link link). Multiple threads have suggested running npm cache clear --force , but this has not helped remedy the issue. This thread seems to suggest I'm not the first person to have this issue: since our NPM version is past v5, so I'm not sure how relevant this is.


Given all of the research above, and my current research in issue #1053 , my first thought was that the Linux install must be missing a linux-based dependency that cordova relies on.

I'm not entirely satisfied with this answer for a few reasons; first, it leaves me with few lines of inquiry. Second, the issue in 1053 is an issue with the browser version of the app. That is, I would be somewhat surprised if the android build of the app had dependencies that needed to match the build OS. As of writing, I'm re-reading some of our our internal docs (issues such as #958), in case I missed any past work on this issue.

All of this to say, I'll keep this thread updated as I find more information! If anyone has experience building on a non-MacOS device, feel free to throw in your two cents on this thread -- any advice is greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant