oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
73.41k stars 2.7k forks source link

Bun on Termux #8685

Open n0thhhing opened 7 months ago

n0thhhing commented 7 months ago

What is the type of issue?

Documentation is missing

What is the issue?

Missing Docs for Termux users

Intro

While the primary focus of Bun is not currently on Android platforms like Termux, this aims to help Termux users install and use Bun smoothly.

installation

To begin, refer to the official Bun installation documentation using the following command:

curl -fsSL https://bun.sh/install | bash

However, after installation, attempting to use Bun may result in a Command not found error.

Solutions

Native Termux

  1. Start by addressing this issue with the only current viable solution — utilizing Termux's glibc package, which is detailed here.
  2. After installation, set an alias using grun to process the binary correctly.
    • Open your preferred configuration file (e.g., vim ~/.zshrc).
    • Add the alias:
      alias bun="grun ~/.bun/bin/bun"

      Downsides

      While this solution has its usecases, there are some downsides to consider:

Packages Are Limited:

Due to limitations with grun, Bun may encounter difficulties reading and processing node modules, resulting in errors like:

❯ bun run index.ts
error: Cannot find package "some-package" from "/storage/emulated/0/Download/some_project/index.ts"
Limited Functionality:

As of now, due to native permissions and issues with grun, the Bun binary isn't fully processed. Consequently, certain operations may not work correctly:

credits:

Special thanks to issue #5085 for providing insights into fixing package installations. Additionally, credit goes to Denos fix for addressing similar usage issues.

Where Did You Find It?

This issue post aims to address missing documentation for Bun on Termux. It is *not intended to compel developers to prioritize Termux support but rather serves as guidance for users with limited access to environments like Termux. The outlined solutions and insights are derived from mostly original ideas with additional clarification from comments on related issues, particularly issue #5085 and Denos fix.

Electroid commented 7 months ago

Thanks for opening this issue with detailed ideas/workarounds. We have too many other things to prioritize over Android/Termux. If we add it to our docs, there is an implicit expectation that it is a supported platform, when in reality it is not.

n0thhhing commented 7 months ago

understandable, Considering the recent launch of Bun and other urgent matters, addressing concerns related to native Termux may not be the current primary focus. also, prioritizing support for Windows as of now is crucial to avoid potential complications from simultaneous extensive updates, which could negatively impact the ecosystem and workflow.

CodeIter commented 4 months ago

I made a shell script termux-pacman-glibc-setup.sh to setup glibc-runner with pacman on Termux and install Deno.JS and Bun.JS as a demo.