Page.screenshot results in "TypeError: mime.getType is not a function" with Puppeteer v3.2.0
See original GitHub issueMy environment:
- Puppeteer version: v3.2.0
- Platform / OS version: Ubuntu 16.04.6 LTS
- Node.js version: v12.13.1
What steps will reproduce the problem?
- Open a webpage with Puppeteer, such as: https://www.tripadvisor.fr/Restaurants-g187147-Paris_Ile_de_France.html
- Then try to take a screenshot, such as:
await page.screenshot({
path: "/tmp/test-tripadvisor.png",
fullPage: true,
);
What is the expected result?
- We should obtain the full-page screenshot saved at
/tmp/test-tripadvisor.png(this is working perfectly fine with Puppeteer v3.0.0, I havent’ tested with v3.1.0)
What happens instead?
- We obtain this error:
(node:19576) UnhandledPromiseRejectionWarning: TypeError: mime.getType is not a function at Page.screenshot (/home/dev/node-ghost/node_modules/puppeteer/lib/Page.js:651:35) at Page.<anonymous> (/home/dev/node-ghost/node_modules/puppeteer/lib/helper.js:117:27)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
What is TypeError: mime.lookup is not a function in Supertest?
I found the answer, or a fix at least. If I add: .set('Content-Type','application/x-www-form-urlencoded'). the error goes away.
Read more >How to take screenshots using Puppeteer and Headless ...
To use Puppeteer and headless Chrome to create an ExpressJS application that takes website screenshots on Platform.sh.
Read more >mozilla-central: changeset 534188 ...
mach puppeteer-test -On try they appear under the `remote(pup)` symbol, but because they're -a Tier-3 class test job they're not ...
Read more >22.01 - Teradici
Licensed under the MIT License.const BrowserNotSupportedError = new Error("EnvironmentCredential is not supported in the browser.
Read more >puppeteer-full-page-screenshot - npm
A better solution for taking full page screenshot with Puppeteer. Latest version: 1.2.2, last published: a year ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I solved this problem by (re)installing the mime module
npm i mimeReinstalling didn’t work for me.
I fixed it by adding the
typeparam :