PuppeteerSharp:无法启动 Chromium

时间:2021-03-11 17:11:11

标签: puppeteer puppeteer-sharp

将谷歌浏览器更新到最新版本后开始出现错误:89.0.4389.82 (Official Build) (64-bit)。 操作系统:Windows 10

错误:

PuppeteerSharp.ChromiumProcessException: 
Failed to launch Chromium! [0309/160320.924:ERROR:os_crypt_win.cc(70)] Failed to encrypt: The system cannot find the file specified. (0x2)

请帮忙!

2 个答案:

答案 0 :(得分:1)

我在使用应用程序在服务器中启动 chrome 时也遇到了同样的错误。我确实手动升级了谷歌浏览器,一切正常。

答案 1 :(得分:0)

在尝试在生产服务器环境(azure VM 中的 windows server 2019)中运行的 asp.net 应用程序中进行大量工作之后,我想详细说明 vidya 的回答“手动升级谷歌浏览器”:

根据此 URL 上的最新版本手动设置版本号: https://commondatastorage.googleapis.com/chromium-browser-snapshots/index.html?prefix=Win_x64/

在我的情况下,版本是 890410。将您的代码设置为使用此版本而不是 DefaultChromiumRevision

const string ChromiumRevision = "890410";
var options = new BrowserFetcherOptions();
options.Path = HttpContext.Current.Server.MapPath("/App_Data");
var bf = new BrowserFetcher(options);
await bf.DownloadAsync(ChromiumRevision);   
string exePath = bf.GetExecutablePath(ChromiumRevision); 
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
   Headless = true,
   ExecutablePath = exePath,
   Args = new string[]{"--disable-gpu","--no-sandbox"}
}); 
相关问题