未处理的承诺拒绝(拒绝 ID:1):错误:杀死 ESRCH [英] Unhandled promise rejection (rejection id: 1): Error: kill ESRCH

查看:119
本文介绍了未处理的承诺拒绝(拒绝 ID:1):错误:杀死 ESRCH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网络和 SOF 上进行了一些研究,但没有发现对那个错误有什么真正帮助.

I've made some research on the Web and SOF, but found nothing really helpful on that error.

我在 Windows 10 Ubuntu Bash 上安装了 Node 和 Puppeteer,但没能让它工作,但我设法让它在 Windows 上工作,而没有 Bash 在另一台机器上.

I installed Node and Puppeteer with Windows 10 Ubuntu Bash, but didn't manage to make it work, yet I manage to make it work on Windows without Bash on an other machine.

我的命令是:

    node index.js

我的 index.js 尝试截取页面的屏幕截图:

My index.js tries to take a screenshot of a page :

    const puppeteer = require('puppeteer');

    async function run() {
    const browser = await puppeteer.launch();
    const page = await browser.newPage();

    await page.goto('https://github.com');
    await page.screenshot({ path: 'screenshots/github.png' });

    browser.close();
    }

    run();

有人知道我可以解决这个错误:杀死 ESRCH"错误的方法吗?

Does anybody know the way I could fix this "Error: kill ESRCH" error?

推荐答案

我刚刚解决了这个问题.您需要做的是:

I just fixed this issue. What you need to do is the following:

1) 安装 Debian 依赖

1) Install Debian dependencies

您可以在此文档中找到它们:https://github.com/GoogleChrome/puppeteer/blob/master/文档/疑难解答.md

You can find them in this doc: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

sudo apt-get install 所有这些坏孩子.

2) 在启动 puppeteer 时添加 '--no-sandbox' 标志

2) Add '--no-sandbox' flag when launching puppeteer

3) 确保您的 Windows 10 是最新的.我错过了一个让您可以启动 Chrome 的重要更新.

3) Make sure your windows 10 is up to date. I was missing an important update that allowed you to launch Chrome.

这篇关于未处理的承诺拒绝(拒绝 ID:1):错误:杀死 ESRCH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆