termux / proot

An chroot-like implementation using ptrace.
https://wiki.termux.com/wiki/PRoot
Other
751 stars 161 forks source link

nodejs: "Cannot find module '/root'" when running javascript code from binded path #176

Closed Yonle closed 3 years ago

Yonle commented 3 years ago

Problem description

So i want to run nodejs code inside proot that located from another path outside rootfs directory.

So i launch my proot with -b $HOME/BotProject:/root/BotProject. $HOME/BotProject (Or /data/data/com.termux/files/home/BotProject) is where my bot files stored. So when i cd into it and run node index.js, I got this error:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/root'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Steps to reproduce

Expected behavior

NodeJS throws error:

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/root'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Additional information

Application version:
0.117
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://packages.termux.org/apt/termux-main stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
# x11-repo (sources.list.d/x11.list)
deb https://packages.termux.org/apt/termux-x11 x11 main
Updatable packages:
apt/stable 2.3.8 aarch64 [upgradable from: 2.3.6]
ca-certificates/stable 20210603 all [upgradable from: 20210525]
command-not-found/stable 1.63 aarch64 [upgradable from: 1.62]
coreutils/stable 8.32-8 aarch64 [upgradable from: 8.32-7]
curl/stable 7.78.0 aarch64 [upgradable from: 7.77.0-3]
dash/stable 0.5.11.4 aarch64 [upgradable from: 0.5.11.3]
dialog/stable 1.3-20210621-0 aarch64 [upgradable from: 1.3-20210530-0]
diffutils/stable 3.8 aarch64 [upgradable from: 3.7-3]
libandroid-support/stable 28-1 aarch64 [upgradable from: 28]
libcurl/stable 7.78.0 aarch64 [upgradable from: 7.77.0-3]
libgnutls/stable 3.6.16 aarch64 [upgradable from: 3.6.15-3]
libidn2/stable 2.3.2 aarch64 [upgradable from: 2.3.0-2]
libnettle/stable 3.7.3 aarch64 [upgradable from: 3.7.2]
libnghttp2/stable 1.44.0 aarch64 [upgradable from: 1.43.0]
libxcursor/stable 1.2.0-19 aarch64 [upgradable from: 1.2.0-18]
libxfixes/stable 5.0.3-24 aarch64 [upgradable from: 5.0.3-23]
libxi/stable 1.7.10-22 aarch64 [upgradable from: 1.7.10-21]
libxrandr/stable 1.5.2-23 aarch64 [upgradable from: 1.5.2-22]
libxtst/stable 1.2.3-25 aarch64 [upgradable from: 1.2.3-24]
nano/stable 5.8 aarch64 [upgradable from: 5.7]
pcre/stable 8.45 aarch64 [upgradable from: 8.44-1]
qemu-user-aarch64/stable 1:5.2.0-10 aarch64 [upgradable from: 1:5.2.0-9]
termux-tools/stable 0.133-1 all [upgradable from: 0.130]
Android version:
8.1.0
Kernel build information:
Linux localhost 4.9.77+ #1 SMP PREEMPT Fri May 28 23:13:48 CST 2021 aarch64 Android
Device manufacturer:
vivo
Device model:
vivo 1820
Yonle commented 3 years ago

I also already make sure that my code is completely Fine as well. So this is proot issue ig.

Yonle commented 3 years ago

Pardon me. I'm blind & unfocus man.