Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppeteer browser download failed

Tags:

puppeteer

So basically I'm just starting out with puppeteer.js. My systems seems unable to npm install the library correctly. Here is what I did:

  1. Make new directory
  2. Navigate to said directory in bash
  3. npm init -y
  4. npm install puppeteer

After doing those steps I get a error message exactly like this

$ npm i puppeteer

> [email protected] postinstall C:\Users\neilj\Desktop\puppeteer2\node_modules\puppeteer
> node install.js

Browser download failed C:\Users\neilj\Desktop\puppeteer2\node_modules\@puppeteer\browsers\lib\cjs\launch.js:48
    options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
                     ^^^

SyntaxError: Unexpected token '??='
    at wrapSafe (internal/modules/cjs/loader.js:988:16)
    at Module._compile (internal/modules/cjs/loader.js:1036:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (C:\Users\neilj\Desktop\puppeteer2\node_modules\@puppeteer\browsers\lib\cjs\main.js:19:19)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=16.3.0"} (current: {"node":"14.17.5","npm":"6.14.14"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=16.3.0"} (current: {"node":"14.17.5","npm":"6.14.14"})    
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for @puppeteer/[email protected]: wanted: {"node":">=16.3.0"} (current: {"node":"14.17.5","npm":"6.14.14"})npm WARN notsup Not compatible with your version of node/npm: @puppeteer/[email protected]
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

I was wondering if anyone else had come across this error since I cannot seem to find another thread that had this particular issue

I'm basically just trying to get this code installed so I can work with it in the first place. Im intending to get some insight if anyone has any. Thanks

like image 533
Neil Juanillo Avatar asked Nov 01 '25 16:11

Neil Juanillo


1 Answers

This happened to me because I was using Node v14 and puppeteer v20. You'll need Node v15 for puppeteer v20 or puppeteer < v20 with Node v14.

Note: Node v14 supports ?? but not ??= which is supported after Node v15 (source)

like image 180
Callistino Avatar answered Nov 04 '25 10:11

Callistino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!