为什么我在Ubuntu 18.04.4 LTS上运行Puppeteer会出现错误?

问题描述 投票:0回答:1

用同样的设置运行Puppeteer可以正常运行,直到部署到ubuntu VPS上,我得到以下错误。

    internal/util.js:209
    throw new errors.TypeError('ERR_INVALID_ARG_TYPE', 'original', 'function');
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function
    at promisify (internal/util.js:209:11)
    at Object.<anonymous> (/var/www/html/path/node_modules/extract-zip/index.js:11:18)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/var/www/html/path/node_modules/puppeteer/lib/BrowserFetcher.js:25:17)

这是我的源代码。

    const puppeteer = require('puppeteer');

(async() => {

    const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
    const page = await browser.newPage();
    browser.close();

})();

请帮助我。我缺少什么。为什么我在ubuntu 16 VPS上得到这个错误,但在我的Mac上一切运行正常。

node.js puppeteer ubuntu-18.04
1个回答
0
投票

我在Ubuntu 18.04.4上更新了Node.js后,错误信息消失了。

© www.soinside.com 2019 - 2024. All rights reserved.