在本地窗口中配置Puppeter executablePath chrome 木偶演员版本:1.11.0 平台/操作系统版本:Windows 10 pro Node.js版本:12.6.6
当我在windows中进行本地开发测试时,发生的是executablePath中的问题 无法启动chrome!spawn/usr/bin/enoint 我看到windows需要获得完整的路径。否则无法找到chrome.exe 默认代码:在本地窗口中配置Puppeter executablePath chrome 木偶演员版本:1.11.0 平台/操作系统版本:Windows 10 pro Node.js版本:12.6.6,node.js,puppeteer,Node.js,Puppeteer,当我在windows中进行本地开发测试时,发生的是executablePath中的问题 无法启动chrome!spawn/usr/bin/enoint 我看到windows需要获得完整的路径。否则无法找到chrome.exe 默认代码: const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'}); 在windows中,它是这样工作的: const browser = await puppeteer.la
const browser = await puppeteer.launch({executablePath: '/path/to/Chrome'});
在windows中,它是这样工作的:
const browser = await puppeteer.launch({executablePath: 'C:\\your_workspace\\node_modules\\puppeteer\\.local-chromium\\win64-(version)\\chrome-win\\chrome.exe'});
在可视代码中建议路径
也许这会有帮助:
const osPlatform = os.platform(); // possible values are: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
console.log('Scraper running on platform: ', osPlatform);
let executablePath;
if (/^win/i.test(osPlatform)) {
executablePath = '';
} else if (/^linux/i.test(osPlatform)) {
executablePath = '/usr/bin/google-chrome';
}
也许这会有帮助:
const osPlatform = os.platform(); // possible values are: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
console.log('Scraper running on platform: ', osPlatform);
let executablePath;
if (/^win/i.test(osPlatform)) {
executablePath = '';
} else if (/^linux/i.test(osPlatform)) {
executablePath = '/usr/bin/google-chrome';
}
您还可以设置环境变量puppeter\u EXECUTABLE\u PATH
这对于将Puppeter_SKIP_Chromiu DOWNLOAD设置为true非常有用您还可以设置环境变量Puppeter_Executive_PATH
这对于将木偶演员跳过铬下载设置为true非常有用我确认该解决方案在我的案例中工作正常我确认该解决方案在我的案例中工作正常