termux / proot

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

npm install not working #278

Open kde-yyds opened 1 year ago

kde-yyds commented 1 year ago

I'm trying to install electron with npm, but it always fails.

root@localhost ~ [127]# npm install electron -g
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/electron
npm ERR! dest /usr/local/lib/node_modules/.electron-Nfq7WGlg
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/electron' -> '/usr/local/lib/node_modules/.electron-Nfq7WGlg'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-06-21T12_16_22_800Z-debug-0.log
root@localhost ~ [217]# npm cache clear --force -g
npm WARN using --force Recommended protections disabled.
root@localhost ~# npm install electron -g
npm ERR! code ENOTEMPTY
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/electron
npm ERR! dest /usr/local/lib/node_modules/.electron-Nfq7WGlg
npm ERR! errno -39
npm ERR! ENOTEMPTY: directory not empty, rename '/usr/local/lib/node_modules/electron' -> '/usr/local/lib/node_modules/.electron-Nfq7WGlg'

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-06-21T12_17_58_037Z-debug-0.log
root@localhost ~ [217]#

I'm running proot with this script

#!/data/data/com.termux/files/usr/bin/bash
rootfs=/data/data/com.termux/files/home/containers/debian12
shell=/usr/bin/fish
#command="dbus-launch startxfce4"
#command="dbus-launch startplasma-x11"
command=fish
pulseaudio --start
env -u LD_PRELOAD proot --ashmem-memfd --root-id --pwd=/root --mount=/dev/pts -b /dev/ptmx -b /vendor -b /dev/random -b /dev/urandom --mount=/dev/zero:/dev/wlan0 --rootfs=$rootfs --mount=$rootfs/proc/stat:/proc/stat --mount=/system --mount=/apex --kill-on-exit --mount=/storage:/storage --mount=/data/data/com.termux/files:/media/termux  --mount=/data/data/com.termux/files/usr/tmp:/dev/shm -b /data --sysvipc -L -H --link2symlink --mount=/proc:/proc --mount=/dev/mali0:/dev/mali0 --mount=/data/data/com.termux/files/usr/tmp:/tmp --mount=/sdcard:/media/sd  /usr/bin/env -i HOSTNAME=proot HOME=/root USER=root TERM=xterm-256color SDL_IM_MODULE=fcitx XMODIFIERS=\@im=fcitx QT_IM_MODULE=fcitx GTK_IM_MODULE=fcitx TMPDIR=/tmp DISPLAY=:1 PULSE_SERVER=tcp:127.0.0.1:4713 LANG=zh_CN.UTF-8 LC_TELEPHONE=zh_CN.UTF-8 LC_ADDRESS=zh_CN.UTF-8 LC_NUMERIC=zh_CN.UTF-8 LC_NAME=zh_CN.UTF-8 LC_TIME=zh_CN.UTF-8 LC_PAPER=zh_CN.UTF-8 LC_MONETARY=zh_CN.UTF-8 LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=zh_CN.UTF-8 SHELL=$shell PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games SHELL=$shell XDG_RUNTIME_DIR=/tmp/runtime-root $command