How to deploy Nodejs PlayWright (installing deps for chromium)?

I’m trying to install Playwright with a barebones node (lts) setup. With an index file like below


const { chromium } = require("playwright-chromium");

(async () => {
  const browser = await chromium.launch({ chromiumSandbox: false });
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('');
  await browser.close();

My package.json contains the playwright version below, so npm install should work.
"playwright": "^1.21.1",

And then the build/run commands below

npm install && npx playwright install --with-deps chromium
npm run start // node index.js

However, I always get an error browserType.launch: Executable doesn't exist at /opt/render/.cache/ms-playwright/chromium-1000/chrome-linux/chrome That is playwright dependenacies and chromium won’t install properly.

For Heroku, you’d need a Playwright build back.

Has anyone gotten playwright to work with render properly?

Getting an error

Cannot install dependencies for this linux distribution!

Is the only solution to use a docker file?

Hi there,

Thanks for reaching out.

Our native environments don’t current support installing OS-level packages, for that you would need to use Docker to setup your own environment.

There does seem to be a feature request on our feedback site for adding the ability to install packages: Please feel free to upvote/comment.

Kind regards


Damn, I feared that might be the case. Messing around with docker always takes forever.

In case some other poor soul needs to use Node + Playwright, dockerfile worked for me.

# Build Environment: Node + Playwright
FROM node:16

# Env
ENV PATH /app/node_modules/.bin:$PATH

# Export port 3000 for Node

# Copy all app files into Docker Work directory
COPY package*.json /app/
COPY index.ts /app/
COPY src/ /app/src/
COPY tsconfig.json /app/

# Install Deps
RUN npm install

# Build TS into JS to run via Node
RUN npm run build

# Run Node index.js file
CMD [ "npm", "start" ]