question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page.screenshot results in "TypeError: mime.getType is not a function" with Puppeteer v3.2.0

See original GitHub issue

My 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?

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
caida-rickycommented, Jun 11, 2020

I solved this problem by (re)installing the mime module npm i mime

2reactions
nicolas-tcommented, Sep 9, 2020

Reinstalling didn’t work for me.

I fixed it by adding the type param :

await page.screenshot({
	path: "/tmp/test-tripadvisor.png",
	fullPage: true,
	type: 'png' // <-
})
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found