workeffortwaste / layout-shift-gif

Visualise the Core Web Vitals metric Cumulative Layout Shift (CLS) with a simple GIF.
https://defaced.dev/tools/layout-shift-gif-generator/
Apache License 2.0
149 stars 15 forks source link

TypeError: Cannot read properties of undefined (reading 'Nexus 5X') #9

Closed wormeyman closed 2 years ago

wormeyman commented 2 years ago

Hi Thanks for adding apple silicon support, I tried it again and i get this issue:

╭─ericjohnson@ej-mba-m1 ~
╰─$ layout-shift-gif --url https://blacklivesmatter.com/ --device mobile --output layout-shift.gif                           1 ↵
file:///opt/homebrew/lib/node_modules/layout-shift-gif/layout-shift-gif.js:59
const phone = devices['Nexus 5X']
                     ^

TypeError: Cannot read properties of undefined (reading 'Nexus 5X')
    at file:///opt/homebrew/lib/node_modules/layout-shift-gif/layout-shift-gif.js:59:22
    at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:337:24)
    at async loadESM (node:internal/process/esm_loader:88:5)
    at async handleMainPromise (node:internal/modules/run_main:61:12)

Node.js v17.4.0

Steps to reproduce:

  1. Run npm install -g layout-shift-gif
  2. Run layout-shift-gif --url https://blacklivesmatter.com/ --device mobile --output layout-shift.gif
  3. The error above occurs.
workeffortwaste commented 2 years ago

Good catch, it looks like the device list was missing after switching to puppeteer-extra. I've pushed a new version to npm, can you check it now?