Acode icon indicating copy to clipboard operation
Acode copied to clipboard

Node.js "os.networkInterfaces()" fails with "ERR_SYSTEM_ERROR" in Alpine terminal environment

Open egoletter opened this issue 5 months ago • 5 comments

Check for existing issues

  • [x] Completed

Describe the bug / provide steps to reproduce it

The Alpine Linux terminal environment provided by Acode appears to block access to network interface information.

This causes Node.js APIs that depend on network interface enumeration to fail.

For example:

node -e "console.log(require('os').networkInterfaces())"

produces:

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_interface_addresses returned Unknown system error 13 (Unknown system error 13)

Stack trace:

SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_interface_addresses returned Unknown system error 13 (Unknown system error 13)
    at Object.networkInterfaces (node:os:218:16)
    at [eval]:1:27
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:446:12
    at [eval]-wrapper:6:24
    at runScriptInContext (node:internal/process/execution:444:60)
    at evalFunction (node:internal/process/execution:88:30)
    at evalScript (node:internal/process/execution:100:3)
    at node:internal/main/eval_string:74:3 {
  code: 'ERR_SYSTEM_ERROR',
  info: {
    errno: 13,
    code: 'Unknown system error 13',
    message: 'Unknown system error 13',
    syscall: 'uv_interface_addresses'
  },
  errno: [Getter/Setter],
  syscall: [Getter/Setter]
}

Impact

Many Node.js tools rely on "os.networkInterfaces()". In my case, "wrangler dev" fails because Node cannot enumerate network interfaces.

This may also affect other development tools, local dev servers, and packages that attempt to detect local IP addresses.

Expected behavior

Node.js should be able to access network interface information, or the Alpine environment should expose enough functionality for standard networking APIs to work correctly.

Environment

Device Information: WebView Info: Package Name: com.google.android.webview Version: 148.0.7778.215

App Info: Name: Acode Package Name: com.foxdebug.acode Version: 1.12.4 Version Code: 974

Device Info: Android Version: 12 Manufacturer: vivo Model: V2120 Platform: Android Cordova Version: 15.0.0

Screen Info: Width: 427 Height: 949 Color Depth: 24

Additional Info: Language: en-GB User Agent: Mozilla/5.0 (Linux; Android 12; V2120 Build/SP1A.210812.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/148.0.7778.215 Mobile Safari/537.36

If applicable, add mockups / screenshots regarding your vision

No response

If applicable, attach your Acode.log file to this issue.

Acode.log

egoletter avatar Jun 12 '26 01:06 egoletter

This error occurs because uv_interface_addresses (called by os.networkInterfaces()) requires access to the getifaddrs/netlink socket syscall to read the network interface list, but in the Acode environment (Termux/Android sandbox), this access is blocked by Android permissions — errno 13 = EACCES (Permission denied). So it's not a Node.js bug, but a limitation of the Android sandbox that doesn't allow apps to read system network interface information directly. Solution/workaround: avoid calling os.networkInterfaces() in this environment. There's no way to "fix" it except running in an environment with more permissions (e.g., full Linux/VM, not inside the regular Acode/Termux Android environment).

Rakha-Rayz avatar Jun 12 '26 02:06 Rakha-Rayz

Thank you for the explanation.

However, I don't think this is a general Android sandbox limitation, because the same Node.js API works correctly in Termux on the same device.

For example:

node -e "console.log(require('os').networkInterfaces())"

returns network interface information successfully in Termux, but throws:

uv_interface_addresses returned Unknown system error 13

inside Acode's Alpine Linux environment.

Since the same Android device and the same Node.js API behave differently between Termux and Acode, it seems the issue is specific to Acode's Linux environment rather than Android itself.

egoletter avatar Jun 12 '26 02:06 egoletter

Thank you for the explanation.

However, I don't think this is a general Android sandbox limitation, because the same Node.js API works correctly in Termux on the same device.

For example:

node -e "console.log(require('os').networkInterfaces())" returns network interface information successfully in Termux, but throws:

uv_interface_addresses returned Unknown system error 13 inside Acode's Alpine Linux environment.

Since the same Android device and the same Node.js API behave differently between Termux and Acode, it seems the issue is specific to Acode's Linux environment rather than Android itself.

thanks alot i just learnt something useful from ur comment

Victozee26 avatar Jun 12 '26 07:06 Victozee26

Just to add context, I also use proot (Debian) inside Termux and face the exact same error. So this isn't specific to Acode's Alpine environment; it's a general proot limitation regardless of how or where you run it.

Native Termux works because it runs directly on Android's Linux kernel. Any proot-based environment — whether through Acode or Termux, loses access to real network interface data because proot can't expose that at the kernel level.

As a workaround, try passing the host manually. Wrangler has an --ip flag:

wrangler dev --ip 0.0.0.0

This sidesteps the interface enumeration entirely. Vite and Next.js have --host for the same reason.

Spectra010s avatar Jun 14 '26 00:06 Spectra010s

@egoletter

try :

node -e "
const { execSync } = require('child_process');
let out;
try { out = execSync('ifconfig -a 2>/dev/null').toString(); }
catch (e) { console.log('{}'); process.exit(0); }
const result = {};
let iface = null;
for (const line of out.split('\n')) {
  const m = line.match(/^([a-zA-Z][\w.-]*):?\s/);
  if (m) { iface = m[1]; continue; }
  const ip = line.match(/inet (?:addr:)?([0-9.]+)/);
  if (ip && iface) { (result[iface] = result[iface] || []).push(ip[1]); }
}
console.log(result);
"

Victozee26 avatar Jul 22 '26 19:07 Victozee26