puppeteer-heap-snapshot
puppeteer-heap-snapshot copied to clipboard
The example in README is not working anymore
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..
[]
➜ ~
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?
@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.
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.
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 🤷♂️
@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());