Termux - npm ERR! Error: EPERM: operation not permitted
Asked Answered
P

3

7

I get these errors when running npm install on Termux (Android). Any solution?

I get these errors when running npm install on Termux (Android). Any solution?

$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"android","arch":"arm64"})

npm ERR! path ../@babel/parser/bin/babel-parser.js
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall symlink
npm ERR! Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/storage/emulated/0/web/tbcians/node_modules/.bin/parser'
npm ERR!  { [OperationalError: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/storage/emulated/0/web/tbcians/node_modules/.bin/parser']
npm ERR!   cause:
npm ERR!    { [Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/storage/emulated/0/web/tbcians/node_modules/.bin/parser']
npm ERR!      errno: -1,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'symlink',
npm ERR!      path: '../@babel/parser/bin/babel-parser.js',
npm ERR!      dest: '/storage/emulated/0/web/tbcians/node_modules/.bin/parser' },
npm ERR!   stack:
npm ERR!    "Error: EPERM: operation not permitted, symlink '../@babel/parser/bin/babel-parser.js' -> '/storage/emulated/0/web/tbcians/node_modules/.bin/parser'",
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../@babel/parser/bin/babel-parser.js',
npm ERR!   dest: '/storage/emulated/0/web/tbcians/node_modules/.bin/parser' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /data/data/com.termux/files/home/.npm/_logs/2019-04-21T09_30_40_780Z-debug.log
$
Permutation answered 21/4, 2019 at 9:41 Comment(3)
Have you tried with sudo npm install? – Cramer
Can't use sudo on Termux. My device is not rooted. – Permutation
You can check this link github.com/st42/termux-sudo, to add termux sudo privileges – Cramer
B
7

Android does not allow symlinks to exist in the Internal Shared storage, simply moving the directory web from your Internal Storage to the Termux home directory which lies in the data partition, will solve your error. In order to do this, simply use the command mv -r /sdcard/web ~. Note that this will move your directory named web to /data/data/com.termux/files/home/web.

Bitterroot answered 15/6, 2020 at 19:43 Comment(0)
E
0

or you can just move your entire project to termux home directory

Extravert answered 26/6, 2022 at 15:52 Comment(0)
B
-1

Here's a simple way to fix this:

  1. Go to settings
  2. Go to app management
  3. App settings
  4. Select Termux
  5. Go to permission
  6. Than click allow file and Media

DONE πŸ‘

Bromate answered 3/11, 2022 at 16:57 Comment(1)
Allowing the app to have the permission to use the files doesn't allow symlinks at all. Unless you have root access, you have to move the project to termux's directory, at least up till today. – Deputy

© 2022 - 2024 β€” McMap. All rights reserved.