Kuingsmile / PicList-Core

modified PicGo core
MIT License
55 stars 13 forks source link

Error: Couldn't find the required `xsel` binary #6

Closed lqllife closed 6 months ago

lqllife commented 6 months ago

系统是 Ubuntu 22.04,报错如下:

[PicList Server] get the request from IP: 172.27.0.1
[PicList Server] upload files in list
[PicList INFO]: Before transform
[PicList INFO]: Transforming... Current transformer is [path]
[PicList INFO]: Before upload
[PicList INFO]: Uploading... Current uploader is [local]
[PicList WARN]: failed
[PicList ERROR]: Error: Couldn't find the required `xsel` binary. On Debian/Ubuntu you can install it with: sudo apt install xsel
    at handler (/root/.piclist/node_modules/clipboardy/lib/linux.js:7:9)
    at Object.copySync (/root/.piclist/node_modules/clipboardy/lib/linux.js:33:5)
    at exports.writeSync (/root/.piclist/node_modules/clipboardy/index.js:38:13)
    at Qr.<anonymous> (/root/.piclist/node_modules/picgo-plugin-autocopy/dist/index.js:50:34)
    at Qr.emit (node:events:518:28)
    at Rt.afterUpload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:37811)
    at async Rt.start (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:36132)
    at async Qr.upload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:146437)
    at async /usr/local/share/.config/yarn/global/node_modules/piclist/bin/picgo-server:220:22
[PicList Server] upload result
 /root/.piclist/local_data/7875116530120342.png

在容器中执行:

/ # apt install xsel
/bin/sh: apt: not found
lqllife commented 6 months ago

这样可以:apk add xsel

现在报这个错:

[PicList Server] get the request from IP: 172.27.0.1
[PicList Server] upload files in list
[PicList INFO]: Before transform
[PicList INFO]: Transforming... Current transformer is [path]
[PicList INFO]: Before upload
[PicList INFO]: Uploading... Current uploader is [local]
[PicList WARN]: failed
[PicList ERROR]: Error: xsel: Can't open display: (null)
: Not a tty

    at module.exports.sync (/root/.piclist/node_modules/execa/index.js:303:26)
    at Object.copySync (/root/.piclist/node_modules/clipboardy/lib/linux.js:31:18)
    at exports.writeSync (/root/.piclist/node_modules/clipboardy/index.js:38:13)
    at Qr.<anonymous> (/root/.piclist/node_modules/picgo-plugin-autocopy/dist/index.js:50:34)
    at Qr.emit (node:events:518:28)
    at Rt.afterUpload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:37811)
    at async Rt.start (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:36132)
    at async Qr.upload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:146437)
    at async /usr/local/share/.config/yarn/global/node_modules/piclist/bin/picgo-server:220:22
[PicList Server] upload result
 /root/.piclist/local_data/54355416530119722.png

配置文件:

{
  "picBed": {
    "uploader": "local",
    "current": "local",
    "transformer": "path",
    "local": {
      "_configName": "local-A",
      "path": "/root/.piclist/local_data",
      "customUrl": "",
      "webPath": ""
    }
  },
  "picgoPlugins": {
    "picgo-plugin-autocopy": true
  }
}
Kuingsmile commented 6 months ago

https://github.com/sindresorhus/clipboardy/issues/63

参考这个issue,应该是没有终端tty界面导致的

lqllife commented 6 months ago

不行,还是一样的报错。 这是容器的问题,不是您项目的问题,我再找找其他办法。 谢谢。👍

Kuingsmile commented 6 months ago

但有个问题 autocopy即使可以运行成功 也是拷贝到了容器所在镜像的剪贴板里,在容器外也拿不到额

lqllife commented 6 months ago

是picgo/piclist本身就不支持这样吗,还是不能使用docker部署?

Kuingsmile commented 6 months ago

使用docker部署的不行 如果是有GUI界面的linux版本是可以用的

lqllife commented 6 months ago

我的使用场景是用在windows上的obsidian,我不想再在windows上下载一个PicList的windows客户端,于是准备将PicList-Core部署在我的云服务上,图片也上传到云服务器的磁盘中。

您看这样,是不是不能用docker了?

Kuingsmile commented 6 months ago

我的使用场景是用在windows上的obsidian,我不想再在windows上下载一个PicList的windows客户端,于是准备将PicList-Core部署在我的云服务上,图片也上传到云服务器的磁盘中。

您看这样,是不是不能用docker了?

不要用picgo-autocopy这个插件就可以 obsidian上的image auto upload plugin插件里填core对应的上传接口地址就可以了,然后启用远程服务器模式

lqllife commented 6 months ago

谢谢,禁用 picgo-autocopy 插件就行了,看了下插件的介绍,是用不到的这个功能的,当时应该是为了测试picgo时随便装的一个插件。

还想请教下,我应该怎么使用外网访问图片呢? 容器中存放图片的路径是 /root/.piclist/local_data,宿主机中的是 /opt/piclist/local_data,现在图片能上传了,但是没法访问。 customUrlwebPath应该怎么配置?

config.json

{
  "picBed": {
    "uploader": "local",
    "current": "local",
    "transformer": "path",
    "local": {
      "_configName": "local-A",
      "path": "/root/.piclist/local_data",
      "customUrl": "www.xxxx.com",
      "webPath": "local_data"
    }
  },
  "picgoPlugins": {
    "picgo-plugin-autocopy": false
  }
}

docker-compose.yml

version: '3.8'

services:
  node:
    image: 'kuingsmile/piclist:latest'
    container_name: piclist
    restart: always
    ports:
      - 5211:36677
    volumes:
      - './piclist:/root/.piclist'
    command: node /usr/local/bin/picgo-server -k abc_piclist
Kuingsmile commented 6 months ago

你需要在你部署core的服务器上开一个web服务,然后绑定自己的域名,webPath是拼接域名和路径的时候用的,因为有时候web服务的路径和绝对路径是不一致的

lqllife commented 6 months ago

明白了,谢谢。👍