Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在本地窗口中配置Puppeter executablePath chrome 木偶演员版本:1.11.0 平台/操作系统版本:Windows 10 pro Node.js版本:12.6.6_Node.js_Puppeteer - Fatal编程技术网

在本地窗口中配置Puppeter executablePath chrome 木偶演员版本:1.11.0 平台/操作系统版本:Windows 10 pro Node.js版本:12.6.6

在本地窗口中配置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

当我在windows中进行本地开发测试时,发生的是executablePath中的问题

无法启动chrome!spawn/usr/bin/enoint

我看到windows需要获得完整的路径。否则无法找到chrome.exe

默认代码:

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非常有用

我确认该解决方案在我的案例中工作正常我确认该解决方案在我的案例中工作正常