> server@1.0.0 test
> jest
FAIL tests/header.test.js
✓ Add two numbers (3ms)
✕ We can lauch a browser (21ms)
● We can lauch a browser
kill ESRCH
at process.kill (node:internal/process/per_thread:220:13)
at forceKillChrome (node_modules/puppeteer/lib/Launcher.js:169:19)
at Function.launch (node_modules/puppeteer/lib/Launcher.js:144:7)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.<anonymous> (tests/header.test.js:17:19)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 passed, 2 total
Snapshots: 0 total
Time: 1.227s
Ran all test suites.
우분투에서 puppeteer 를 활용한 jest 테스트 중 브라우저가 실행조차 되지 않는 문제가 발생했다.
물론 이전에 윈도우 환경에서는 잘 작동하던 puppeteer 이니까 넘기고
인터넷에서 해법을 찾아본 결과 Ubuntu 에서 아래의 커맨드를 입력하면 된다.
sudo apt-get install ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils
다시 퍼페티어 실행하면 잘됨
> server@1.0.0 test
> jest
PASS tests/header.test.js
✓ Add two numbers (3ms)
✓ We can lauch a browser (264ms)
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 1.237s
Ran all test suites.
물론 WSL에서는 GUI Ubuntu 가 아니기때문에
puppeteer.launch({ headless : false })
로 실행을 하면 무조건 오류가 발생한다.
브라우저가 열리는것을 직접 확인하려면 윈도우에서 돌리는게 더 나을듯..
'Linux' 카테고리의 다른 글
Ubuntu 구버전 다운로드 (0) | 2023.07.31 |
---|---|
[WSL] System has not been booted with systemd as init system (PID 1). (0) | 2023.03.13 |
WSL 터미널 글자 색 변경하기 (0) | 2023.01.02 |
[WSL] WSL에서 실행중인 Mysql 윈도우에서 접속하기 (0) | 2023.01.01 |
High CPU usage caused by WSL2 with Docker (2) | 2022.09.28 |
댓글