Termux - npm ERR!错误:EPERM:操作不允许

6
在Termux (Android)上运行npm install时,我遇到了这些错误。有解决方法吗?
$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: 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
$

你尝试过使用sudo npm install吗? - vitomadio
无法在Termux上使用sudo。我的设备没有root权限。 - Savvy Sage
您可以查看此链接 https://github.com/st42/termux-sudo,以添加Termux的sudo权限。 - vitomadio
3个回答

6

Android不允许符号链接存在于内部共享存储中,在Termux主目录所在的数据分区中移动目录web,即可解决错误。为此,请使用命令mv -r /sdcard/web ~。请注意,这将把名为web的目录移动到/data/data/com.termux/files/home/web


0

或者你可以将整个项目移动到Termux的主目录中


0
这里有一个简单的方法来解决这个问题:
  1. 进入设置
  2. 进入应用管理
  3. 应用设置
  4. 选择Termux
  5. 进入权限
  6. 然后点击允许文件和媒体

完成


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接