[英]node.js win10 puppeteer executablePath string
I am on windows 10 command prompt with a node.js project that is supposed to use puppeteer to launch chrome and then do some other web crawling things.我在 windows 10 命令提示符上使用 node.js 项目,该项目应该使用 puppeteer 启动 chrome,然后执行一些其他 web 爬行的事情。 I have run npm install for this project, but when I run it with
node app.js
, I get an error for 'ERROR: The process "chrome.exe" not found.', my puppeteer code inits the browser like this:我已经为这个项目运行了 npm 安装,但是当我使用
node app.js
运行它时,我收到一个错误“错误:找不到进程“chrome.exe”。”,我的 puppeteer 代码像这样初始化浏览器:
let args = ["--lang=en-US,en", '--no-sandbox', '--disable-setuid-sandbox', '--disable-extensions']
var exPath = "C:\\Users\\marti\\Downloads\\chrome-win\\chrome-win\\chrome.exe"
var options = {
executablePath: exPath,
headless: false,
args
};
In a different command prompt window if i run start C:\\Users\\marti\\Downloads\\chrome-win\\chrome-win\\chrome.exe
it will open a chromium window perfectly fine.在不同的命令提示符 window 如果我运行
start C:\\Users\\marti\\Downloads\\chrome-win\\chrome-win\\chrome.exe
它将完美地打开一个铬 Z05B8C74CBD96FBF2DE4C1A352702。 Is there an arg I might be missing for node.js windows 10 command prompt puppeteer?对于 node.js windows 10 命令提示符傀儡,我可能缺少一个 arg 吗?
Your request should be an asynchronous:您的请求应该是异步的:
const browser = await puppeteer.launch({
executablePath: "C:\\Users\\marti\\Downloads\\chrome-win\\chrome-win\\chrome.exe",
headless: false,
args: ["--lang=en-US,en", '--no-sandbox', '--disable-setuid-sandbox', '--disable-extensions']
});
And the function in which you are using puppeteer should be of type async function
并且您使用 puppeteer 的 function 应该是
async function
类型
If the issue still persists try adding '--disable-dev-shm-usage'
argument to args.如果问题仍然存在,请尝试在 args 中添加
'--disable-dev-shm-usage'
参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.