adriancooney / puppeteer-heap-snapshot

API and CLI tool to fetch and query Chome DevTools heap snapshots.
MIT License
1.35k stars 68 forks source link

The example in README is not working anymore #11

Open LuisPaGarcia opened 11 months ago

LuisPaGarcia commented 11 months ago

Hi! I'm trying to test the example from the README file, but is now working anymore.

➜  ~ npx puppeteer-heap-snapshot query -u https://www.instagram.com/p/CVEJmFTgdRw/ -p video_view_count,video_play_count,shortcode,video_url --no-headless | jq .

>> Opening Puppeteer page at: https://www.instagram.com/p/CVEJmFTgdRw/
>> Taking heap snapshot..
[]
➜  ~
escodel commented 11 months ago

Same. Getting the following error from within StackBlitz:

Error: Could not find Chrome (ver. 115.0.5790.170). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.

Are puppeteer and/or chromium itself required to be installed first?

LuisPaGarcia commented 11 months ago

@escodel Yes, puppeteer is a pre-requisite for this. And puppeteer will install chromium under the hood. Maybe puppeteer-heap-snapshot assume you already have puppeteer installed.

rmonvfer commented 10 months ago

I also have the same issue, maybe we could try to figure out if instagram has made any changes to the property names. If @adriancooney could point us in the right direction would be great, because I've been trying to manually reproduce the original blog post but to no avail.

escodel commented 10 months ago

I'm using "type": "module" for ESM in my package.json, but for some reason it's saying 'export' is an unexpected token from puppeteer-heap-snapshot. Found this StackOverflow answer that says there could be an issue with TS types?

Also noticed this PR #10 was opened a few weeks back, especially because syntax was incorrect for puppeteer method .goto() but still can't find a true solution 🤷‍♂️

Bialogs commented 10 months ago

@escodel I had the same issue with respect to export and can recommend just using as common js and don't bother with esm as it seems broken at the moment.

const puppeteer = require('puppeteer');
const phs = require('puppeteer-heap-snapshot');
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://github.com/adriancooney/puppeteer-heap-snapshot');
const heapSnapshot = await phs.captureHeapSnapshot(page.target());