使用Google Chrome Puppeteer

F.M*_*F.M 3 google-chrome headless puppeteer

我使用的是Debian 8.7.1。

我想使用Google Chrome Puppeteer。

我有一个名为script.js的文件,并且按照Puppeteer文档中的建议放置了获取屏幕截图命令。

为了运行JavaScript文件,我运行以下命令:

nodejs script.js
Run Code Online (Sandbox Code Playgroud)

但这有一些错误:

(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.
Run Code Online (Sandbox Code Playgroud)

nodejs -vv8.4.0并且npm -v5.3.0

请帮我解决这个问题。

小智 7

来自错误信息:

Chromium revision is not downloaded. Run "npm install"

cd /path/to/puppeteer && npm install

此命令会将铬下载到 /path/to/project/node_modules/puppeteer/.local-chromium/