Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Google Chrome Puppeteer

I'm on Debian 8.7.1.

I want to use Google Chrome Puppeteer.

I have a file named script.js, and I put the getting screenshot commands as recommended in the Puppeteer documentation.

For running the JavaScript file, I run the following command:

nodejs script.js

But it has some errors:

(node:929) UnhandledPromiseRejectionWarning: Unhandled promise rejection   (rejection id: 2): AssertionError [ERR_ASSERTION]: Chromium  revision is not downloaded. Run "npm install"

(node:929) [DEP0018] DeprecationWarning: Unhandled promise rejections are   deprecated. In the future, promise rejections that are not handled will   terminate the Node.js process with a non-zero exit code.

nodejs -v is v8.4.0 and npm -v is 5.3.0.

Please help me to solve this problem.

like image 937
F.M Avatar asked Dec 24 '22 14:12

F.M


2 Answers

From error info:

Chromium revision is not downloaded. Run "npm install"

cd /path/to/puppeteer && npm install

this command will download chromium to /path/to/project/node_modules/puppeteer/.local-chromium/

like image 125
ooops Avatar answered Jan 14 '23 12:01

ooops


sudo npm install -g puppeteer --unsafe-perm=true --allow-root

worked!

like image 33
Jeff Kymer Avatar answered Jan 14 '23 12:01

Jeff Kymer