Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Cannot find module 'puppeteer' from 'puppet-scraper.cjs.development.js' #11

Open
moltar opened this issue May 11, 2020 · 2 comments · May be fixed by #14
Open

Cannot find module 'puppeteer' from 'puppet-scraper.cjs.development.js' #11

moltar opened this issue May 11, 2020 · 2 comments · May be fixed by #14
Assignees
Labels
bug Something isn't working

Comments

@moltar
Copy link

moltar commented May 11, 2020

Getting the following errors in Jest when trying to use the module:

    Cannot find module 'puppeteer' from 'puppet-scraper.cjs.development.js'

    Require stack:
      node_modules/puppet-scraper/dist/puppet-scraper.cjs.development.js
      node_modules/puppet-scraper/dist/index.js
      src/puppeteer.ts
      src/puppeteer.test.ts

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:299:11)
      at Object.<anonymous> (node_modules/puppet-scraper/dist/puppet-scraper.cjs.development.js:8:33)

I think it is probably this line:

import Puppeteer, { Page } from 'puppeteer';

It assumes one has puppeteer installed, but in reality it is also possible to use only puppeteer-core.

I think, in fact, it would be the preferred way for a library to use the -core version, as it wouldn't pull in Chromium by default.

@moltar
Copy link
Author

moltar commented May 11, 2020

Just looked inside the package.json, and there seems to be a mis-match.

The dependency is declared as puppeteer-core, but peer dep is puppeteer and the actual code uses puppeteer.

@grikomsn grikomsn self-assigned this May 11, 2020
@grikomsn grikomsn added the bug Something isn't working label May 11, 2020
@grikomsn
Copy link
Owner

Thanks for the heads up! Will do a fix after this, or if you want to submit a PR that's also great. 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
2 participants