Cannot find module 'playwright-core'
BusDriver01 opened this issue ยท 8 comments
Thank you for this library, I have found playwright to be superior to puppeteer and would prefer to use it on AWS.
Unfortunately currently I am getting an error whenever I try to use it, including the simple demo code in the README.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'playwright-core'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (E:\Nodejs\AllTheComps\playwright\dev\node_modules\playwright-aws-lambda\dist\src\chromium.js:5:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
The offending line is:
const playwright = require("playwright-core");
I'm developing on Windows but this happened on Lambda as well. I have npm install'd playwright-core
, it definitely exists in node_modules
@BusDriver01 playwright-core
is a peer dependency, so it does not come packaged with this module. Can you make sure that you installed it into your project as a direct dependency and not a dev dependency? Are you bundling your lambda somehow?
I installed both modules via npm: npm install playwright-core playwright-aws-lambda --save
Previously I had installed the full playwright
-- could that be causing a conflict?
In node_modules, there are 3 related directories: playwright, playwright-aws-lambda, and playwright-core
Having the same issue.
Anyone found a solution for this? Facing same issue
This error is due to the issue in the core package. In version 1.1.0 the playwright-core package does not contain anymore a valid index.js / entrypoint.
1.0.2: https://unpkg.com/playwright-core@1.0.2/index.js <-- expected
1.1.0: https://unpkg.com/playwright-core@1.1.0/index.js <-- actual
Temporary Solution is to downgrade to 1.0.2
@sanudatta11 thanks for looking into this. Disappointing that the Playwright team shipped a breaking change like this in a minor version...The reason I chose to use playwright-core
originally is to avoid the browser(s) post install process in the main playwright
package. The playwright-core
package only contained the core JS logic used to drive the underlying browsers.
Was going to write that this bug has been reported at playwright
but I see you've participated in that thread already. Hope we'll see a fix very soon, the PR has been submitted. Thanks again @austinkelleher and @sanudatta11 !