sindresorhus/clipboardy

Couldn't find the `xsel` binary and fallback didn't work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel

iuriigrynykha opened this issue · 7 comments

I've encountered such an issue upon running the tests in Jenkins on a remote Linux machine.

After sudo apt install xsel the following error message is displayed

"Both xsel and fallback failed".

Can you help me to solve this issue, please?

If you manage to log the underling error you'll likely see something like the following:

xsel: Can't open display: (null)
      : Inappropriate ioctl for device

It looks like the library doesn't work in a headless environment.

I'm not sure about Jenkins, but on GitHub Actions you can use this action - https://github.com/marketplace/actions/gabrielbb-xvfb-action - to provide a virtual display whilst running the tests.

You can also use xvfb-run from the xvfb package.

e.g. on circleci:

- run:                                                                    
    name: Run Tests                                                       
    command: xvfb-run npm t

I just ran into this problem as well on jenkins. Not sure if it is a jenkins specific thing as this build run in docker containers.

However, it works find on Node 12 and 14. But fails with this error on node 15

I solved this like this #65

error = new Error('Couldn't find the xsel binary and fallback didn't work. On Debian/Ubuntu you can install xsel with: sudo apt install xsel');

I also encounter this error when i try to host my Discord Bot using Heroku, when using my own terminal node . everything is fine. btw im using 2.3.0 version because the 3.0.0 gives me error

@iuriigrynykha Were you able to solve this problem?

"Both xsel and fallback failed"

Also having this issue.