Module not found: Error: Can't resolve 'ws'
See original GitHub issueSteps to reproduce
Tell us about your environment:
- Puppeteer version: 2.1.1
- Platform / OS version: Windows 10
- URLs (if applicable):
- Node.js version: v13.9.0
What steps will reproduce the problem?
- ng new test
- cd test
- npm install puppeteer
Please include code that reproduces the issue.
import * as puppeteer from 'puppeteer';
GeneraPdf() {
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://google.com');
await page.pdf({path: 'hn.pdf', format: 'A4'});
await browser.close();
})();
}
What is the expected result?
Compile
What happens instead?
PS C:\Users\Giacomo\Documents\Progetti\Angular\Testpuppeteer> ng serve
chunk {main} main.js, main.js.map (main) 13.7 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 140 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 10.1 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.75 MB [initial] [rendered]
Date: 2020-02-28T11:06:47.573Z - Hash: fed516f7933ffc2f9d0a - Time: 5671ms
ERROR in ./node_modules/puppeteer/lib/WebSocketTransport.js
Module not found: Error: Can't resolve 'ws' in 'C:\Users\X\Documents\Progetti\Angular\Testpuppeteer\node_modules\puppeteer\lib'
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Module not found error can't resolve 'ws' in puppeteer-core/lib
I am getting the same error while compiling. ERROR in ./node_modules/puppeteer/lib/WebSocketTransport.js Module not found: Error: Can't resolve ...
Read more >Can't run puppeteer in react app, Module not found
Simple answer : You can't run puppeteer in react app. React is a client side framework. which means it runs in browser.
Read more >module-not-found - Next.js
A module not found error can occur for many different reasons: The module you're trying to import is not installed in your dependencies;...
Read more >Module not found: Can't resolve 'zlib' error [Solved] | bobbyhadz
The error "Module not found: Can't resolve 'zlib'" most commonly occurs when you import a Node.js specific function in your frontend (e.g. React.js)...
Read more >A Fresh Create React App But always compiling with Error
ERROR in Module not found: Error: Can't resolve ... #2/frontend/node_modules/webpack-dev-server/client/index.js?protocol=ws%3A&hostname= ...
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 FreeTop 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
Top GitHub Comments
So i was able to fix this issue by installing puppeteer-core and then in my webpack config adding
so you would need to pass in the chrome executable path in order for launch / connect to work now
Works for me! thanks man