Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL - Doesn't appear to Install Chromium #598

Closed
jestrjk opened this issue Jan 23, 2020 · 5 comments
Closed

WSL - Doesn't appear to Install Chromium #598

jestrjk opened this issue Jan 23, 2020 · 5 comments

Comments

@jestrjk
Copy link

jestrjk commented Jan 23, 2020

Using WSL WSL 2 on Windows 10 does not appear to install any browser when I yarn install. I have not tested it on WSL 1.

Running your reference examples results in:

$yarn install
yarn install v1.21.1
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.07s.
() /.../playwright $node main.js 
(node:1704) UnhandledPromiseRejectionWarning: Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
    at CRPlaywright.launchServer (/home/-/playwright/node_modules/playwright-core/lib/server/crPlaywright.js:87:23)
    at async CRPlaywright.launch (/home/-/playwright/node_modules/playwright-core/lib/server/crPlaywright.js:64:24)
    at async /home/-/playwright/main.js:4:21
  -- ASYNC --
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:54:23)
    at CRPlaywright.launch (/home/-/playwright/node_modules/playwright-core/lib/server/crPlaywright.js:64:35)
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:55:31)
    at /home/-/playwright/main.js:4:38
    at Object.<anonymous> (/home/-/playwright/main.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
  -- ASYNC --
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:54:23)
    at /home/-/playwright/main.js:4:38
    at Object.<anonymous> (/home/-/playwright/main.js:9:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11
(node:1704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1704) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
// package.json
{
  "name": "playwright",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@types/node": "^13.1.8",
    "playwright": "^0.9.21"
  }
}
// main.ts
const playwright = require('playwright').chromium;  // Or 'firefox' or 'webkit'.

(async () => {
  const browser = await playwright.launch();
  const context = await browser.newContext();
  const page = await context.newPage('http://example.com');
  // other actions...
  await browser.close();
})();

Compiles to

"use strict";
// main.ts
const playwright = require('playwright').chromium; // Or 'firefox' or 'webkit'.
(async () => {
    const browser = await playwright.launch();
    const context = await browser.newContext();
    const page = await context.newPage('http://example.com');
    // other actions...
    await browser.close();
})();
@jestrjk
Copy link
Author

jestrjk commented Jan 23, 2020

Using npm install results in a download of chromium, firefox, webkit, but still errors out on execution with:

$node main.js
(node:1789) UnhandledPromiseRejectionWarning: Error: Failed to launch browser!
/home/-/playwright/node_modules/playwright-core/.local-chromium/linux-733125/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/Microsoft/playwright/blob/master/docs/troubleshooting.md

    at onClose (/home/-/playwright/node_modules/playwright-core/lib/server/processLauncher.js:135:20)
    at Interface.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/server/processLauncher.js:128:65)
    at Interface.emit (events.js:215:7)
    at Interface.close (readline.js:403:8)
    at Socket.onend (readline.js:180:10)
    at Socket.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1184:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21)
  -- ASYNC --
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:54:23)
    at CRPlaywright.launch (/home/-/playwright/node_modules/playwright-core/lib/server/crPlaywright.js:64:35)
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:55:31)
    at /home/-/playwright/main.js:5:38
    at Object.<anonymous> (/home/-/playwright/main.js:10:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
  -- ASYNC --
    at CRPlaywright.<anonymous> (/home/-/playwright/node_modules/playwright-core/lib/helper.js:54:23)
    at /home/-/playwright/main.js:5:38
    at Object.<anonymous> (/home/-/playwright/main.js:10:3)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11
(node:1789) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1789) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@JoelEinbinder
Copy link
Contributor

Possibly a duplicate of #581

@enjikaka
Copy link

enjikaka commented Feb 6, 2020

I am seeing this on macOS as well. The problem here is Yarn not installing the
browsers; while npm install does.

@Keeady
Copy link

Keeady commented Feb 24, 2020

For mac OS, running node node_modules/playwright/install.js installed the browsers and resolved my issue. I couldn't run npm because I was in yarn exclusive environment.

@pavelfeldman
Copy link
Member

Folding this into #581 and #1085

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants