English 中文(简体)
Playwright Vercel Error: browserType.launch: Executable doesn t exist at /home/sbx_user1051/.cache/ms-playwright/chromium-1067/chrome-linux/chrome
原标题:
The bounty expires in 3 days. Answers to this question are eligible for a +100 reputation bounty. jveldridge wants to draw more attention to this question.

I tried and tested on a different local environment like Windows, Linux, mac and everywhere it works fine but once I deploy my nextjs app on Vercel, I m getting the below error

browserType.launch: Executable doesn t exist at /home/sbx_user1051/.cache/ms-playwright/chromium-1067/chrome-linux/chrome
╔═════════════════════════════════════════════════════════════════════════╗
║ Looks like Playwright Test or Playwright was just installed or updated. ║
║ Please run the following command to download new browsers:              ║
║                                                                         ║
║     npx playwright install                                              ║
║                                                                         ║
║ <3 Playwright Team                                                      ║
╚═════════════════════════════════════════════════════════════════════════╝
    at pdf (/var/task/.next/server/pages/api/jobOrders/pdf.js:58:80)
    at pdfHandler (/var/task/.next/server/pages/api/jobOrders/pdf.js:91:31) {
  name:  Error 
}

To resolve this issue, I tried modifying the build command in Vercel deployment settings to

next build && npx playwright install

enter image description here

enter image description here enter image description here While I see the browsers like Chrome and firefox getting installed successfully, still I wonder why I m getting this error.

问题回答

Generally, you should run tests before deploying your application during the CI phase. Production deployment should only proceed after all tests have been successfully completed.

However, you can use Vercel s webhooks with your Git provider to run an end-to-end test suite after your Vercel deployment has finished. This example will use GitHub Actions.

Configure a GitHub Action

  1. Connect your Git repository to your project. For new projects, you can follow these docs. For existing projects, visit your Git configuration in the Settings tab of your project dashboard.
  2. Create a GitHub workflow in .github/workflows with the following:
name: Playwright Tests

on:
  deployment_status:
jobs:
  run-e2es:
    if: github.event_name ==  deployment_status  && github.event.deployment_status.state ==  success 
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install dependencies
        run: npx playwright install --with-deps
      - name: Run tests
        run: npx playwright test
        env:
          BASE_URL: ${{ github.event.deployment_status.environment_url }}

A GitHub Action that runs an end-to-end test suite using Playwright, testing the Vercel Preview Deployment.





相关问题
VS 2008 : How to publish with out DLLs?

I have developed a web application in Visual Studio 2008 and want to publish it in to the production server. I see a publish option there.But its producing files with DLL. I dont want to publish only ...

Apache: Deploying a new site to the server

I have a site currently live on a domain. I would like to switch it to a new site, that is currently in a password protected sub directory on this server. I have a "Site Maintenance in Progress" page....

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Pylons deployment questions

I m a beginner with Pylons and I ve mostly developed on my localhost using the built-in web server. I think it s time to start deployment for my personal blog, I have a Debian Lenny server with ...

Do I want Publish or Release Build in VB.net?

I wrote a little (like 40 lines little) Winforms application with VB.net in Visual Studio 2010. Now I ve released the code as a Google Code project. It s easy for a developer to get the source but I d ...

Need advice on my PHP development solution

Here is how our current php development solution is set up: Each developer work on their local machine. Each developer commit their change to a common SVN server (intranet). A commit hook upload the ...

loading from JAR files during deployment vs development

when i am loading some data into my java program, i usually use FileInputStream. however i deploy the program as a jar file and webstart, so i have to use getRessource() or getRessourceAsStream() to ...

热门标签