1

I am trying to run the following command but I am getting the error like

pa11y http://example.com/ # Trying to run this on my terminal


Welcome to Pa11y
------------------------
Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
    at Launcher.launch (/usr/lib/node_modules/pa11y/node_modules/puppeteer/lib/Launcher.js:119:15)
    at async runPa11yTest (/usr/lib/node_modules/pa11y/lib/pa11y.js:106:29)
    at async pa11y (/usr/lib/node_modules/pa11y/lib/pa11y.js:55:19)
    at async runProgram (/usr/lib/node_modules/pa11y/bin/pa11y.js:122:19)

I spent around 3-4 hours to fix this but no luck. I have tried every possible solution on the internet which is posted by others who had faced similar errors.

Any help in this regard is helpful

Mahesh
  • 1,117
  • 2
  • 23
  • 42
  • Sounds like possibly Pa11y uses Chromium as a dependency, and Chromium is not installed, it is asking you to run the ```install``` command with idea that the project will install Chromium automatically, recognising that Pa11y needs it - do you have a package.json file, can you see Chromium in there? – Jonny Jan 22 '20 at 17:29
  • @Jonny, I have installed Chromium also, still getting the same error. – Mahesh Jan 22 '20 at 17:30
  • Sounds like it might be a bug with Pa11y - https://github.com/pa11y/pa11y/issues/400 – Jonny Jan 22 '20 at 17:30
  • Not a bug becoz it worked when I tried locally a week ago, now I am trying to install on server, don't know where to get the path for Chrome in puppeteer module – Mahesh Jan 22 '20 at 17:34
  • Ok I see the problem now, I don't know the answer to 'where to get the path for Chrome in puppeteer modue', but it sounds like you are definately not the only one facing this issue so can I suggest you post a new question referring specifically to that issue? – Jonny Jan 22 '20 at 17:56
  • This question is posted specifically pointing to the issue which was mentioned in the heading and the tags – Mahesh Jan 22 '20 at 18:06
  • Are you using Docker on your server @Mahesh? I get this same error when I run puppeteer inside docker, using their recommended settings in the dockerfile. See documentation here: https://github.com/christopher-talke/node-express-puppeteer-pdf-example/blob/master/Dockerfile If you come up with anything, @ me! – Preston Wallace Jan 26 '20 at 07:58
  • @PrestonWallace , I am not using Docker, just directly installing it but unable to! – Mahesh Jan 26 '20 at 09:00

1 Answers1

1

Two questions:

  1. Do you have Chromium installed? pa11y doesn't think so! It could be a wrong version installed if so, or installed in a way that pa11y can't find.
  2. What OS are you running?

The answer to your question depends on your Operating System, because the version of Chromium you need is specific to your OS! If you're running Linux Alpine, the command would be something like this:

apk add -U --no-cache --allow-untrusted udev ttf-freefont chromium git

I had this problem when trying to run the Node package puppeteer (which uses Chromium) in a Docker container running node 12 alpine. I spent all weekend (yes...) to come to the 1 line (yes...) I needed. It turned out I needed to add the above line to my Dockerfile, which installs the necessary fonts and libraries and installs Chromium.

I also had to tell Puppeteer to skip installing Chromium, but I don't think that's applicable to your situation.

If you're running something other than Linux, check out these instructions for installing Chromium: https://www.chromium.org/getting-involved/download-chromium