0

如果容器卷位于闪存驱动器上,我无法在 Node-red 中安装新的调色板,因为 npm 没有正确的访问权限。你能帮助我吗?

# docker-compose.yml

  node-red:
    container_name: node-red
    image: nodered/node-red:latest
    restart: unless-stopped
    environment:
     - TZ=Europe/Rome
    network_mode: "host"
    ports:
     - "1880:1880"
    volumes:
     - /media/data/node-red:/data  <---- MY USB FLASH DRIVE (FAT32 - vfat)
#    - /home/pi/data/node-red:/data.  <<-- default place 
    user: 1000:1000
    depends_on:
#     - homeassistant
     - mosquitto 

操作系统是 pi4 上的 raspian lite,USB 驱动器在启动时安装,带有以下选项:

# /etc/fstab

PARTUUID=af3416fc-01  /media/data vfat    auto,rw,user,users,exec,noatime,uid=1000,gui=1000,umask=000  0  0

这是日志文件

2020-01-11T13:20:54.190Z Install : node-red-contrib-home-assistant-websocket 0.19.3

2020-01-11T13:20:54.216Z npm install --no-audit --no-update-notifier --save --save-prefix="~" --production node-red-contrib-home-assistant-websocket@0.19.3
2020-01-11T13:21:08.370Z [err] npm
2020-01-11T13:21:08.371Z [err]  
2020-01-11T13:21:08.371Z [err] ERR! code EPERM
2020-01-11T13:21:08.372Z [err] npm
2020-01-11T13:21:08.372Z [err]  ERR! syscall symlink
2020-01-11T13:21:08.372Z [err] npm ERR! path
2020-01-11T13:21:08.372Z [err]  ../flat/cli.js
2020-01-11T13:21:08.372Z [err] npm 
2020-01-11T13:21:08.372Z [err] ERR! dest /data/node_modules/.bin/flat
2020-01-11T13:21:08.372Z [err] npm
2020-01-11T13:21:08.373Z [err]  ERR! errno -1
2020-01-11T13:21:08.380Z [err] npm
2020-01-11T13:21:08.380Z [err]  ERR! Error: EPERM: operation not permitted, symlink '../flat/cli.js' -> '/data/node_modules/.bin/flat'
2020-01-11T13:21:08.380Z [err] npm ERR!  { [Error: EPERM: operation not permitted, symlink '../flat/cli.js' -> '/data/node_modules/.bin/flat']
2020-01-11T13:21:08.380Z [err] npm ERR!   cause:
2020-01-11T13:21:08.380Z [err] npm 
2020-01-11T13:21:08.381Z [err] ERR!    { Error: EPERM: operation not permitted, symlink '../flat/cli.js' -> '/data/node_modules/.bin/flat'
2020-01-11T13:21:08.381Z [err] npm ERR!
2020-01-11T13:21:08.381Z [err]       errno: -1,
2020-01-11T13:21:08.381Z [err] npm ERR!      code: 'EPERM',
2020-01-11T13:21:08.381Z [err] npm ERR!      syscall: 'symlink',
2020-01-11T13:21:08.381Z [err] npm
2020-01-11T13:21:08.381Z [err]  ERR!      path: '../flat/cli.js',
2020-01-11T13:21:08.381Z [err] npm
2020-01-11T13:21:08.381Z [err]  ERR!      dest: '/data/node_modules/.bin/flat' },
2020-01-11T13:21:08.381Z [err] npm 
2020-01-11T13:21:08.381Z [err] ERR!   stack:
2020-01-11T13:21:08.381Z [err] npm 
2020-01-11T13:21:08.382Z [err] ERR!    'Error: EPERM: operation not permitted, symlink \'../flat/cli.js\' -> \'/data/node_modules/.bin/flat\'',
2020-01-11T13:21:08.382Z [err] npm ERR!
2020-01-11T13:21:08.382Z [err]    errno: -1,
2020-01-11T13:21:08.382Z [err] npm ERR!
2020-01-11T13:21:08.382Z [err]    code: 'EPERM',
2020-01-11T13:21:08.382Z [err] npm ERR!
2020-01-11T13:21:08.382Z [err]    syscall: 'symlink',
2020-01-11T13:21:08.382Z [err] npm ERR!
2020-01-11T13:21:08.382Z [err]    path: '../flat/cli.js',
2020-01-11T13:21:08.382Z [err] npm ERR!   dest: '/data/node_modules/.bin/flat',
2020-01-11T13:21:08.382Z [err] npm ERR!   parent: 'data' }
2020-01-11T13:21:08.383Z [err] npm
2020-01-11T13:21:08.383Z [err]  ERR! 
2020-01-11T13:21:08.383Z [err] npm ERR! The operation was rejected by your operating system.
2020-01-11T13:21:08.383Z [err] npm ERR! It is likely you do not have the permissions to access this file as the current user
2020-01-11T13:21:08.383Z [err] npm
2020-01-11T13:21:08.383Z [err]  ERR! 
2020-01-11T13:21:08.383Z [err] npm 
2020-01-11T13:21:08.383Z [err] ERR! If you believe this might be a permissions issue, please double-check the
2020-01-11T13:21:08.383Z [err] npm 
2020-01-11T13:21:08.383Z [err] ERR! permissions of the file and its containing directories, or try running
2020-01-11T13:21:08.383Z [err] npm ERR!
2020-01-11T13:21:08.383Z [err]  the command again as root/Administrator.
2020-01-11T13:21:08.408Z [err] 
2020-01-11T13:21:08.409Z [err] npm ERR! A complete log of this run can be found in:
2020-01-11T13:21:08.409Z [err] npm
2020-01-11T13:21:08.409Z [err]  ERR!     /usr/src/node-red/.npm/_logs/2020-01-11T13_21_08_392Z-debug.log
2020-01-11T13:21:08.423Z rc=255

编辑:添加完整的 /etc/fstab 行和从 webbrowser 获得的 npm 安装日志

提前致谢

4

1 回答 1

2

它不起作用,因为 U 盘上的胖文件系统不支持符号链接,npm 试图将其用作安装节点的一部分。

您最好的选择是重新格式化 USB 记忆棒以使用 ext2(或类似的)作为文件系统。

于 2020-01-11T14:29:08.520 回答