メンチカツには醤油でしょ!!

AWS/Java/Node.js/Spreadsheets/Docker/Jenkins/コミュニティ・勉強会レポを主とした技術系ブログ

Puppeteerを実行するとTypeError [ERR_INVALID_ARG_TYPE]: The "original" argument must be of type function

現象

node index.js などのかんたんな実行でもエラーが出る。なおrequireするだけでもエラーになる。エラーの内容はつぎの通り。

> node index.js
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> (C:\workspaces\your-application\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> (C:\workspaces\your-application\node_modules\puppeteer-core\lib\BrowserFetcher.js:25:17)

結論

Node.jsのバージョンが古いです。10.x 以降にしましょう。

他人の意外とハマったりしますよね^^

参考

https://github.com/puppeteer/puppeteer/issues/5687