Chen Peleg
Chen Peleg

Reputation: 2124

Playwright Error: Process from config.webServer was not able to start. Exit code: 2

Followed the instructions on https://playwright.dev/docs/intro#installing-playwright, and got this error:

Error: Process from config.webServer was not able to start. Exit code: 2

My setup is React with Typescript and Vite.

The command I use: playwright test

The config file web server part:

import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  testDir: './e2e',
  fullyParallel: true,
  forbidOnly: !!process.env.CI,
  retries: process.env.CI ? 2 : 0,
  workers: process.env.CI ? 1 : undefined,
  reporter: 'html',
  use: {
      trace: 'on-first-retry',
  },

  projects: [
    {
        name: 'chromium',
        use: { ...devices['Desktop Chrome'] },
    },

    {
        name: 'firefox',
        use: { ...devices['Desktop Firefox'] },
    },

    {
        name: 'webkit',
        use: { ...devices['Desktop Safari'] },
    },
  ],
  webServer: {
      command: 'npm run build && npm run dev',
      url: 'http://127.0.0.1:3000',
      reuseExistingServer: !process.env.CI,
   },
});

The HTML Report says the same thing.

What am I doing wrong?

Upvotes: 0

Views: 1971

Answers (1)

Chen Peleg
Chen Peleg

Reputation: 2124

Thank you @ggorlen I had a problem with the build: The run build failed, fixed the TS error and Playwright works well.

Upvotes: 0

Related Questions