'"puppeteer"' has no exported member 'puppeteer' using Typescript
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 8.0.0 / 7.1.0
- Platform / OS version: Windows 10
- URLs (if applicable):
- Node.js version: 14.16.0
What steps will reproduce the problem?
Please include code that reproduces the issue.
- Install
puppeteerand@types/puppeteer 5.4.3 - Create a
.tsfile with the following code
import { puppeteer } from "puppeteer";
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com', {
waitUntil: 'networkidle2',
});
// page.pdf() is currently supported only in headless mode.
// @see https://bugs.chromium.org/p/chromium/issues/detail?id=753118
await page.pdf({
path: 'hn.pdf',
format: 'letter',
});
await browser.close();
})();
- Get the error
Module '"puppeteer"' has no exported member 'puppeteer'.ts(2305)at the first line
What is the expected result?
What happens instead?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
[Bug] TypeScript issues with puppeteer v7 ("no exported ...
Solution: Use puppeteer@5 for now. Longer answer: It's painful to see that puppeteer broke perfectly fine typings through @types/puppeteer . Due ...
Read more >Puppeteer types node_modules/puppeteer/lib/types"' has no ...
So, say if I ran into a ... has no exported member HttpMethod error, I would create a typings file, (e.g. httpMethod.type.ts )...
Read more >node_modules/puppeteer/lib/types.d.ts - devtools ... - Google Git
A Browser is created when Puppeteer connects to a Chromium instance, ... **NOTE** BrowserFetcher is not designed to work concurrently with other.
Read more >angular/core/core"' has no exported member ... - appsloveworld
The way I check that in my projects is to look for angular different than 10 in your package-lock.json file to find what...
Read more >puppeteer-extra - npm
puppeteer -extra is a drop-in replacement for puppeteer, // it augments the installed puppeteer with plugin functionality.
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

Try to add following in your tsconfig.json:
If you open the following file “node_modules/@types/puppeteer/index.d.ts”, you will notice there is no default export. Instead each class, interface, etc. are exported just with the “export” statement. So if you want to import something from puppeteer and you are using ES6 Modules, you have to use curly braces. e.g.:
More Infos
However, Typescript offers the feature “allowSyntheticDefaultImports”. Basically it allows to import everything as default if there is no default export in the file.