Jenkins error Install Xvfb and run Cypress again

Create a pipeline to do the jenkins cypress test, but I always run it, make a mistake, and try various solutions, including Jenkins Xvfb, but I still didn’t succeed.

Error

+ npm run exec:e2e

> [email protected] exec:e2e /var/lib/jenkins/workspace/project/myproject
> npx cypress run

It looks like this is your first time using Cypress: 3.4.0

[?25l[01:56:21]  Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [started]
[01:56:21]  Verifying Cypress can run /var/lib/jenkins/.cache/Cypress/3.4.0/Cypress [failed]
[?25hYour system is missing the dependency: Xvfb

Install Xvfb and run Cypress again.

Read our documentation on dependencies for more information:

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.

----------

Error: spawn Xvfb ENOENT

----------

Platform: linux (Ubuntu Linux - 19.04)
Cypress Version: 3.4.0
[?25hnpm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] exec:e2e: `npx cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] exec:e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /var/lib/jenkins/.npm/_logs/2019-07-24T01_56_21_795Z-debug.log

Source: StackOverflow