{ let-6ren">
gpt4 book ai didi

node.js - 类型错误 [ERR_INVALID_ARG_TYPE] : The "original" argument must be of type function puppeteer node js

转载 作者:行者123 更新时间:2023-12-03 09:33:08 25 4
gpt4 key购买 nike

我被困在这里了一段时间我不明白这个问题。请有人在这个主题上启发我。这是代码。

const puppeteer = require('puppeteer');
(async() => {
let infourl = 'https://www.imdb.com/title/tt0111161/?ref_=fn_al_tt_3';
let browser = await puppeteer.launch();
let page = await browser.newPage();
await page.goto(infourl, { waitUntil:'networkidle2' });
let data = await page.evaluate( () =>{
let stats = document.querySelector('div[class="title_wrapper"]').innerText;
return {stats};
});
console.log(data);
debugger;
await browser.close();
})();

这是日志::
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> (/home/hadi/Desktop/datachori/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> (/home/hadi/Desktop/datachori/node_modules/puppeteer/lib/BrowserFetcher.js:25:20)

最佳答案

它发生在最新版本的 puppeteer 上。
您的脚本将在较低版本中正常工作。
试试这个脚本:

npm i -save puppeteer@1.7.0

关于node.js - 类型错误 [ERR_INVALID_ARG_TYPE] : The "original" argument must be of type function puppeteer node js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61770784/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com