microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.28k stars 3.62k forks source link

[Bug]: `npx playwright-chromium install --with-deps` fails in v1.42.0 #29711

Closed fjeldstad closed 7 months ago

fjeldstad commented 7 months ago

Version

1.42.0

Steps to reproduce

Run the following command:

npx playwright-chromium@1.42.0 install --with-deps

Expected behavior

Playwright installs successfully.

Actual behavior

An error is thrown:

node:internal/modules/cjs/loader:553
      throw e;
      ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/program' is not defined by "exports" in /[...]/node_modules/playwright-core/package.json
    at new NodeError (node:internal/errors:405:5)
    at exportsNotFound (node:internal/modules/esm/resolve:259:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:589:9)
    at resolveExports (node:internal/modules/cjs/loader:547:36)
    at Module._findPath (node:internal/modules/cjs/loader:621:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1034:27)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)
    at Object.<anonymous> (/[...]/node_modules/playwright-chromium/cli.js:18:21) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v20.6.1

Additional context

I have tested this both locally on macOS 14.3.1 and in CI (Ubuntu 20.04) - same result. If I run the same command using version 1.41.2 everything works.

Environment

System:
    OS: macOS 14.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 25.07 MB / 32.00 GB
  Binaries:
    Node: 20.6.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
    pnpm: 8.6.3 - /usr/local/bin/pnpm
  IDEs:
    VSCode: 1.86.2 - /usr/local/bin/code
  Languages:
    Bash: 3.2.57 - /bin/bash
DRichter-r commented 7 months ago

It seems there is a missing export in the playwright-core/package.json

I think adding the export "./lib/program": "./lib/cli/program.js" might fix this problem.

pavelfeldman commented 7 months ago

The fix will be a part of 1.42.1 patch release.