I have a Windows laptop with the latest Node LTS version 20.14.0. I tried to install Playwright with the command npm init playwright@latest
but I keep getting the below error:
Downloading browsers (npx playwright install)…
Downloading FFMPEG playwright build v1009 from https://playwright.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
1.4 MiB [================ ] 78% 0.0sError: Download failed: server closed connection. URL: https://playwright.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
at IncomingMessage.<anonymous> (C:\Users\...\e2e\node_modules\playwright-core\lib\server\registry\oopDownloadBrowserMain.js:89:24)
at IncomingMessage.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Downloading FFMPEG playwright build v1009 from https://playwright-akamai.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
1.4 MiB [============== ] 71% 0.1sError: Download failed: server closed connection. URL: https://playwright-akamai.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
at IncomingMessage.<anonymous> (C:\Users\...\e2e\node_modules\playwright-core\lib\server\registry\oopDownloadBrowserMain.js:89:24)
at IncomingMessage.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Downloading FFMPEG playwright build v1009 from https://playwright-verizon.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
1.4 MiB [=============== ] 74% 0.1sError: Download failed: server closed connection. URL: https://playwright-verizon.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip
at IncomingMessage.<anonymous> (C:\Users\...\e2e\node_modules\playwright-core\lib\server\registry\oopDownloadBrowserMain.js:89:24)
at IncomingMessage.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Failed to install browsers
Error: Failed to download FFMPEG playwright build v1009, caused by
Error: Download failure, code=1
at ChildProcess.<anonymous> (C:\Users\...\e2e\node_modules\playwright-core\lib\server\registry\browserFetcher.js:91:16)
at ChildProcess.emit (node:events:519:28)
at ChildProcess._handle.onexit (node:internal/child_process:294:12)
Error: Command failed: npx playwright install
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at checkExecSyncError (node:child_process:890:11)
at execSync (node:child_process:962:15)
at executeCommands (C:\Users\...\AppData\Local\npm-cache\_npx\d352e76cc6b4974c\node_modules\create-playwright\lib\index.js:4519:39)
at Generator.run (C:\Users\...\AppData\Local\npm-cache\_npx\d352e76cc6b4974c\node_modules\create-playwright\lib\index.js:4690:5)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async C:\Users\...\AppData\Local\npm-cache\_npx\d352e76cc6b4974c\node_modules\create-playwright\lib\index.js:4981:3 {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 23804,
stdout: null,
stderr: null
}
Not sure how to get rid of this error and install Playwright properly. Any help would be appreciated.
I figured out the solution for this error:
ffmpeg-win64
from the link provided in the error i.e., https://playwright.azureedge.net/builds/ffmpeg/1009/ffmpeg-win64.zip.ffmpeg-win64.zip
and placed the file ffmpeg-win64.exe
in C:\Users\username\AppData\Local\ms-playwright\chromium-1117\chrome-win folder.npx playwright install
. There may still be some errors with the firefox browser installation for playwright. After rerunning the command, I got 3 new additional folders, ffmpeg-1009
, firefox-1449
and webkit-2003
, in C:\Users\username\AppData\Local\ms-playwright\
folder.ffmpeg-win64.exe
in the C:\Users\username\AppData\Local\ms-playwright\firefox-1449\firefox folder
.npx playwright install
. This time everything got installed correctly.npm init playwright@latest
. This time everything should be installed correctly.