Node.js 树莓皮零w上的木偶演员
我想在Raspberry pi zero w上运行一个带有Puppeter的node js脚本, 但我得到了一个错误:Node.js 树莓皮零w上的木偶演员,node.js,linux,npm,raspberry-pi,puppeteer,Node.js,Linux,Npm,Raspberry Pi,Puppeteer,我想在Raspberry pi zero w上运行一个带有Puppeter的node js脚本, 但我得到了一个错误: (node:5699) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process! /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 1: /SteamChe
(node:5699) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 1: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: �: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 1: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: ELF: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 2: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: p#: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 3: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: p#: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 4: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: @l�: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 5: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: pX: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 6: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: pX: not found
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 7: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: Syntax error: "(" unexpected
/SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: 4: /SteamCheaper/node_modules/puppeteer/.local-chromium/linux-722234/chrome-linux/chrome: ��q: not found
你能告诉我,我能用它做什么吗?木偶演员默认使用捆绑铬。错误表明它无法启动它 您应该手动安装Chromium,并让木偶演员使用该版本。 假设您已将其安装在
/usr/bin/chromium
中,类似的操作将完成此工作:
const browser = await puppeteer.launch({product: 'chrome', executablePath: '/usr/bin/chromium' });
下面是让Chrome headless和木偶演员在Raspberry Pi上工作的基本代码,其中包括Raspbian Stretch Lite的新安装
sudo-apt安装chromium浏览器chromium编解码器ffmpeg
sudo安装npm
npm安装木偶演员-core@v1.11.0
const puppeter=require('puppeter-core');
const browser=wait puppeter.launch({executablePath:'/usr/bin/chromium browser'});
应该是可执行路径:'/usr/bin/chromium browser'
但是产品:'chrome'
是关键