-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[BUG] npm doesn't work on Android #5878
Comments
Did you try this? |
|
npm@9 no longer attempts to modify file ownership. that change should resolve this issue for you. please feel free to reopen this issue, ideally with reproduction steps, if you're still experiencing this problem after updating to the latest npm@9. |
I have the same problem shown by @licy183. After installing Node, we get npm v8, and after upgrading to v9, it is too late, the damage has already been done in the cache folder. Note: I am using Termux and used |
@papb have you tried installing node using the only official mechanism, a download off of nodejs.org? |
I don't think it is possible without proot. Termux is an Linux emulator on Android, and the libc library that all its packages are linked against is Bionic libc, the same as Android's libc. The official build of node is linked against glibc. Glibc and bionic libc are totally different implementations of the C runtime library. Actually, this is a bug of cacache which I've reported in npm/cacache#155. async function moveFile (src, dest) {
const isWindows = process.platform === 'win32'
+ const isAndroid = process.platform === 'android'
+
+ if (isAndroid) {
+ return move(src, dest)
+ }
// This isn't quite an fs.rename -- the assumption is that
// if `dest` already exists, and we get certain errors while
// trying to move it, we should just not bother. |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
~ $ npm install yarn
npm ERR! code EACCES
npm ERR! syscall link
npm ERR! path /data/data/com.termux/files/home/.npm/_cacache/tmp/14de33dd
npm ERR! dest /data/data/com.termux/files/home/.npm/_cacache/content-v2/sha512/d1/d2/d481d770644c0c5e31275a2b952a18da6097da58f146549fb26a5f5d8ac389ffcd10db5d924df1176590499cd2d92b5c21f948efab003774723c809d2d6c
npm ERR! errno EACCES
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 10427:10427 "/data/data/com.termux/files/home/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /data/data/com.termux/files/home/.npm/_logs/2022-11-21T01_31_59_253Z-debug-0.log
Expected Behavior
NPM should install package successfully.
Steps To Reproduce
In Termux, run
Then error message will occur.
Environment
Additional Infomation
I've reported it in npm/cacache#155.
fs.link
will try to use hard link, which is disallowed by seccomp in Android. The maintainer of termux packages have applied a patch to solve this, but when users updatecacache
ornpm
, the patch will not work anymore.Related issues: termux/termux-packages#11293, termux/termux-packages#13293
Possible patch: https://github.com/termux/termux-packages/blob/master/packages/nodejs/deps-npm-node_modules-cacache-lib-util-move-file.js.patch
The text was updated successfully, but these errors were encountered: