sindresorhus / fast-cli

Test your download and upload speed using fast.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't run fast-cli on new raspbian fully updated installation.

quarky42 opened this issue · comments

Here is what I have done:
I installed the:
latest Raspbian with desktop: 2021-01-11-raspios-buster-armhf-full.zip on a headless Raspberry Pi 3B+

I ran:
sudo apt-get update
sudo apt-get dist-upgrade

Rebooted.
Installed:
latest Nodej 15.x using
curl -sL https://deb.nodesource.com/setup_15.x | sudo -E bash -
sudo apt-get install -y nodejs

Installed:
latest fast-cli according to the info on the fast-cli github,

I saw there was an update npm so I ran this to update to the latest:
sudo npm install -g npm@latest

When I try to run:
fast --upload --single-line

I get this error message:

Failed to launch chrome!
/usr/lib/node_modules/fast-cli/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: 1: /usr/lib/node_modules/fast-cli/node_modules/puppeteer/.local-chromium/linux-686378/chrome-linux/chrome: Syntax error: Unterminated quoted string

TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

I rebooted again and get the same error message.

I've tried installing chrome:
sudo apt-get install chromium
sudo apt-get install chromium-browser

I was able to use that last one to save a PDF file:
chromium-browser --headless --disable-gpu --print-to-pdf https://www.google.com
That results in a pdf file being saved at the location of running it.

Not sure what else is missing. If you know of a dependency that is required to run fast-cli as it depends on puppeteer, can you just come out and say what it is?

I've looked at the troubleshooting there and I do not see the applicable section. It seems like there is something missing from your installation instructions.

If it is related to a headless install, it would still be worth mentioning that your fast-cli instructions as they are written either require a monitor or a package being added along with the necessary command.

According to this:
puppeteer/puppeteer#2124

"You cant use the chromium built library from puppeteer on PI. You need to update your built in chromium on the PI and use that one in your code. See @scissorsneedfoodtoo's comment above.

For builds on ARM they should disable building of the chromium by default since it does not work or fix it so it will run. Confuses many people it seems."

I'll repeat: "and use that one in your code." I don't see in your code where I can change what browser is being used. I could have easily missed it, not being familiar with your script.

Since you are the developer of fast-cli, you are relying on puppetter. At the very least you could document how one is supposed to make your fast-cli utilize the arm version of chromium-browser.

After installing the ARM verison of the chromium browser using:
sudo apt-get install chromium-browser

In /usr/lib/node_modules/fast-cli/api.js I found:
const browser = await puppeteer.launch({args: ['--no-sandbox']});

I replaced it with:
const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium-browser',args: ['--no-sandbox']});

And now fast-cli works. It's only getting between 27 and 35 mbps on the download. It's getting normal speeds on the upload, but I need to troubleshoot that aspect my network, next.

commented

Tested and worked on RPi4 with aapanel and pm2 installed! There was a minor change I want to indicate here.

In /usr/lib/node_modules/fast-cli/api.js
should be changed to directory created by PM2, for me it is

/www/server/nvm/versions/node/v16.15.0/lib/node_modules/fast-cli/api.js

On aarch64 ArchLinuxARM it works with the chromium package and the following

const browser = await puppeteer.launch({executablePath: '/usr/bin/chromium', args: ['--no-sandbox']});

Without modifying any code, you can try this.

apt install chromium
export PUPPETEER_SKIP_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
npm install fast-cli