puppeteer: [Bug]: Pupeeteer does not launch in latest version
Bug description
I am running pupeteer in WSL, ubuntu 20.04. I was able to run puppeteer v 18.1.0 by adding my chrome.exe from Windows to $PATH and launching puppeteer with
browser = await puppeteer.launch({
executablePath: 'chrome.exe',
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
However in the latest version (18.2.1) I get the error
FAIL src/App.e2e.test.js ● Test suite failed to run
Cannot find module 'puppeteer-core/internal/common/DeviceDescriptors.js' from 'node_modules/puppeteer/lib/cjs/puppeteer/puppeteer.js' Require stack: node_modules/puppeteer/lib/cjs/puppeteer/puppeteer.js src/App.e2e.test.js at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:324:11) at Object.<anonymous> (node_modules/puppeteer/src/puppeteer.ts:18:1)
Puppeteer version
18.2.1
Node.js version
16.17.0
npm version
8.19.2
What operating system are you seeing the problem on?
Windows
Relevant log output
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 23 (2 by maintainers)
I get a similar error with
puppeteer@19.7.5
:Error: Could not resolve module "puppeteer-core/internal/puppeteer-core.js"
(same error as in: https://github.com/Studiosity/grover/issues/182)In my case, I’m not using
jest
. I’m callingpuppeteer
through aparcel
plugin (parcel@2.8.3
).Rolling back to:
npm install puppeteer@18.1.0
✅ worksnpm install puppeteer@18.2.x
❌ fails with a similar (though not equal) error:Error: Could not resolve module "puppeteer-core/internal/common/DeviceDescriptors.js"
Note that puppeteer@18.2.0 (https://github.com/puppeteer/puppeteer/pull/9023) (https://github.com/puppeteer/puppeteer/commit/f42336cf83982332829ca7e14ee48d8676e11545) separated
puppeteer
andpuppeteer-core
. Likely a bug was introduced; not directly related tojest
orparcel
or any other library.In my humble opinion, this issue is still open.
I am facing the same issue even after upgrading jest to the latest version
Hi, why is it closed? I think the problem is not resolved, it is happenning to me right now. I have react-scripts 5.0.1 too, with puppeteer 19.3.0
npm install puppeteer@18.1.0
Ah,
jest-resolver
… my old nemesis. Yourjest
version is too old. It needsexports
resolution that was introduced in Node 12. I believe Jest versions >= 28 will work.I just had the same problem and upgrading Jest from v27 to v29 worked for me, as expected.
So you either have to upgrade Jest to v28 if you can, or downgrade Puppeteer to v18.1.
I’m not sure why this is closed, as this is still a problem on Puppeteer > 18.1.0 (which is out of support) where you are using ESM module loading, e.g. with Puppeteer 18.2.1:
The problem appears to be the
-r esm
flag, as this works fine for me without it:We are using jest, but our version is up to date (29.7.0), and I’m not sure why that would be involved in a straight
require('puppeteer');
call anyway.Not sure, if that is possible. I am using react-script and the latest version 5.0.1 comes along with “jest”: “^27.4.3”, if I see that correctly. So far I was not able to force the usage of v29. I am open for ideas how to upgrade or how to replace jest with something else
Hi! Is there any update on this issue? I am still getting
Cannot find module 'puppeteer-core/internal/puppeteer-core.js'
on the following config:@townxelliot were you able to find any solution for this?
#_Facing This Issue in in server side(after deploy) - ‘puppeteer’ Working in local machine properly. Any Solution ??
Error: Failed to launch the browser process! /home/abp/.cache/puppeteer/chrome/linux-1108766/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
TROUBLESHOOTING: https://pptr.dev/troubleshooting
It’s working
npm install puppeteer@18.1.0
works for me too.With
puppeteer@20.5.0
i got the error[ERR_PACKAGE_PATH_NOT_EXPORTED]
Now i get:
Downloading Chromium r1045629 - 189.9 Mb [===== ] 26% 16.9s
We are using
nestjs
but we’re not using the latestnestjs
version yet. Luckily, jest28.1.3
works and all our e2e tests passed.I just copied the jest versions from the latest nestjs app to our current app.