lucacasonato/deno-puppeteer

Installing FF fails with v9

MarkTiedemann opened this issue · 1 comments

C:\> set PUPPETEER_PRODUCT=firefox

C:\> deno run -A --unstable https://deno.land/x/puppeteer@9.0.0/install.ts
Download https://deno.land/x/puppeteer@9.0.0/install.ts
Check https://deno.land/x/puppeteer@9.0.0/install.ts

100.00% 21.1s 83721209/83721209

error: Uncaught (in promise) NotFound: The system cannot find the path specified. (os error 3)
      await Deno.writeFile(ff, content);
      ^
    at unwrapOpResult (deno:core/core.js:99:13)
    at async open (deno:runtime/js/40_files.js:46:17)
    at async Object.writeFile (deno:runtime/js/40_write_file.js:58:18)
    at async JSZip.unzip (https://deno.land/x/puppeteer@9.0.0/vendor/puppeteer-core/vendor/zip/mod.ts:203:7)
    at async extractZip (https://deno.land/x/puppeteer@9.0.0/src/deno/BrowserFetcher.ts:473:3)
    at async BrowserFetcher.download (https://deno.land/x/puppeteer@9.0.0/src/deno/BrowserFetcher.ts:283:7)
    at async https://deno.land/x/puppeteer@9.0.0/install.ts:34:27

C:\> deno -V
deno 1.9.2

Installing Chrome worked just fine.

I added a console.log.

The unzip code is trying to write to %localappdata%\deno\deno_puppeteer\firefox\win64-90.0a1\firefox\uninstall\helper.exe.

%localappdata%\deno\deno_puppeteer\firefox\ exists. The other subdirectories, \win64-90.0a1\firefox\uninstall\ don't.

Seems like the code at https://github.com/lucacasonato/deno-puppeteer/blob/9.0.0/vendor/puppeteer-core/vendor/zip/mod.ts#L192-L205 is buggy.

EDIT: As the comment there // hopefully the directory is prior to any files inside it! points out, this is a case where the directory is not prior to the files inside of it.

Will send a PR which adds a check that the base dir exists before writing a file to it.