How do I make Browserify work with Puppeteer?

  • #1
Darkmisc
203
27
TL;DR Summary
I get error messages when I try run Browserify while requiring Puppeteer. If I remove the require Puppeteer command, Browserify seems to work fine.
Hi everyone

I am using Visual Studio Code with Node.js 18.17.1. I installed Puppeteer 22.5.0 with the following command:

Npm install browserify -g

I tried creating a bundle with the following command:

Browserify index.js -o bundle.js

This error message came up:

fs message:
Error: Can't walk dependency graph: ENOENT: no such file or directory, lstat 'C:\Users\*****\Downloads\scraperpuppeteer\fs'

The fs directory in the error message doesn't exist, but I have installed fs and the code works with it (it creates a text file with text that I scraped from a website). Just to be sure, I installed fs again, but got the same error message.

I checked my package.json, and fs is there.

dependencies:
  "dependencies": {
    "fs": "^0.0.1-security",
    "puppeteer": "^22.5.0"
  }


I thought I'd test Browserify with a different folder. It generated a bundle when

const puppeteer = require("puppeteer")

was not in the code, but I get the following error message when I put the require command back in:

puppeteer test error:
Error: Can't walk dependency graph: Cannot find module 'puppeteer-core/internal/puppeteer-core.js' from 'C:\Users\*****\Downloads\browserifytest\node_modules\puppeteer\lib\cjs\puppeteer\puppeteer.js'

Does anyone know why I can't get Browserify to work with Puppeteer?


Thanks
 

Similar threads

  • Programming and Computer Science
Replies
2
Views
92
  • Programming and Computer Science
Replies
2
Views
142
  • Programming and Computer Science
Replies
1
Views
456
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
2
Views
694
  • Programming and Computer Science
Replies
13
Views
3K
  • Programming and Computer Science
Replies
12
Views
8K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
16
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
832
Back
Top