Ошибки Playwright
Установка | |
Похожие статьи |
Не установлен nodejs
[ ERROR ] Error in file '/home/andrei/test/robotframework/RobotFWTutorial/tests/Andrei/andrei.robot' on line 3: Initializing library 'Browser' with no arguments failed: Couldn't execute node. Please ensure you have node.js installed and in PATH. See https://nodejs.org/ for instructions. Original error is [Errno 2] No such file or directory: 'node' Traceback (most recent call last): File "/home/andrei/test/robotframework/venv/lib/python3.9/site-packages/Browser/browser.py", line 715, in __init__ self.playwright = Playwright( File "/home/andrei/test/robotframework/venv/lib/python3.9/site-packages/Browser/playwright.py", line 50, in __init__ self.ensure_node_dependencies() File "/home/andrei/test/robotframework/venv/lib/python3.9/site-packages/Browser/playwright.py", line 65, in ensure_node_dependencies raise RuntimeError(
sudo apt install nodejs
Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libnode64 nodejs-doc Suggested packages: npm The following NEW packages will be installed: libnode64 nodejs nodejs-doc 0 upgraded, 3 newly installed, 0 to remove and 56 not upgraded. Need to get 6,769 kB of archives. After this operation, 30.6 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://fi.archive.ubuntu.com/ubuntu focal/universe amd64 libnode64 amd64 10.19.0~dfsg-3ubuntu1 [5,765 kB] Get:2 http://fi.archive.ubuntu.com/ubuntu focal/universe amd64 nodejs-doc all 10.19.0~dfsg-3ubuntu1 [942 kB] Get:3 http://fi.archive.ubuntu.com/ubuntu focal/universe amd64 nodejs amd64 10.19.0~dfsg-3ubuntu1 [61.1 kB] Fetched 6,769 kB in 5s (1,247 kB/s) Selecting previously unselected package libnode64:amd64. (Reading database ... 439537 files and directories currently installed.) Preparing to unpack .../libnode64_10.19.0~dfsg-3ubuntu1_amd64.deb ... Unpacking libnode64:amd64 (10.19.0~dfsg-3ubuntu1) ... Selecting previously unselected package nodejs-doc. Preparing to unpack .../nodejs-doc_10.19.0~dfsg-3ubuntu1_all.deb ... Unpacking nodejs-doc (10.19.0~dfsg-3ubuntu1) ... Selecting previously unselected package nodejs. Preparing to unpack .../nodejs_10.19.0~dfsg-3ubuntu1_amd64.deb ... Unpacking nodejs (10.19.0~dfsg-3ubuntu1) ... Setting up libnode64:amd64 (10.19.0~dfsg-3ubuntu1) ... Setting up nodejs-doc (10.19.0~dfsg-3ubuntu1) ... Setting up nodejs (10.19.0~dfsg-3ubuntu1) ... update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode Processing triggers for libc-bin (2.31-0ubuntu9.2) ... Processing triggers for man-db (2.9.1-1) ...Старая версия NodeJS
Если установить старый NodeJS , например из репозитория Ubuntu потом поставить npm и попытаться установить Playwright, будет ошибка
npm i playwright
npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'playwright@1.22.2', npm WARN EBADENGINE required: { node: '>=14' }, npm WARN EBADENGINE current: { node: 'v12.22.9', npm: '8.5.1' } npm WARN EBADENGINE } npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: 'playwright-core@1.22.2', npm WARN EBADENGINE required: { node: '>=14' }, npm WARN EBADENGINE current: { node: 'v12.22.9', npm: '8.5.1' } npm WARN EBADENGINE } added 2 packages, and audited 3 packages in 2m found 0 vulnerabilities
Инструкцию по установке новой версии NodeJS можете изучить в статье «Установка последней версии NodeJS»
npm WARN exec The following package was not found and will be installed: playwright
Step 18/18 : RUN npx playwright install chromium --with-deps ---> Running in ec3f57a0348b npm WARN exec The following package was not found and will be installed: playwright ╔═══════════════════════════════════════════════════════════════════════════════╗ ║ WARNING: It looks like you are running 'npx playwright install' without first ║ ║ installing your project's dependencies. ║ ║ ║ ║ To avoid unexpected behavior, please install your dependencies first, and ║ ║ then run Playwright's install command: ║ ║ ║ ║ npm install ║ ║ npx playwright install ║ ║ ║ ║ If your project does not yet depend on Playwright, first install the ║ ║ applicable npm package (most commonly @playwright/test), and ║ ║ then run Playwright's install command to download the browsers: ║ ║ ║ ║ npm install @playwright/test ║ ║ npx playwright install ║ ║ ║ ╚═══════════════════════════════════════════════════════════════════════════════╝
Скорее всего допущена ошибка при
установке Playwright
.
Правильный порядок действий можете изучить
здесь