Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error while an attempt to install Playwright in CI -> Failed at the playwright@1.16.1 install script #9741

Closed
AlexKomanov opened this issue Oct 24, 2021 · 11 comments
Assignees

Comments

@AlexKomanov
Copy link
Contributor

AlexKomanov commented Oct 24, 2021

Context:

  • Playwright Version: 1.16.1
  • Operating System: Windows
  • Node.js version: 14.6.1
  • Browser: Chrome
  • Extra: WebStorm IDE

Code Snippet

> playwright@1.16.1 install C:\builds\gvJP8eTT\0\sro\sro4\uiAutomation\PlaywrightTest\node_modules\playwright
  > node install.js
  
  internal/modules/cjs/loader.js:796
      throw err;
      ^
  
EXEC : error : Cannot find module 'playwright-core/src/utils/registry' [C:\builds\gvJP8eTT\0\sro\sro4\Core\__build\Scripts\SRO.4000.core.integration.xml]
  Require stack:
  - C:\builds\gvJP8eTT\0\sro\sro4\uiAutomation\PlaywrightTest\node_modules\playwright\install.js
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
      at Function.Module._load (internal/modules/cjs/loader.js:686:27)
      at Module.require (internal/modules/cjs/loader.js:848:19)
      at require (internal/modules/cjs/helpers.js:74:18)
      at Object.<anonymous> (C:\builds\gvJP8eTT\0\sro\sro4\uiAutomation\PlaywrightTest\node_modules\playwright\install.js:17:49)
      at Module._compile (internal/modules/cjs/loader.js:955:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
      at Module.load (internal/modules/cjs/loader.js:811:32)
      at Function.Module._load (internal/modules/cjs/loader.js:723:14)
      at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      'C:\\builds\\gvJP8eTT\\0\\sro\\sro4\\uiAutomation\\PlaywrightTest\\node_modules\\playwright\\install.js'
    ]
  }
  npm WARN playwright-seatgeek@1.0.0 No description
  npm WARN playwright-seatgeek@1.0.0 No repository field.
  
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! playwright@1.16.1 install: `node install.js`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the playwright@1.16.1 install script.

package.json file:

{
  "name": "playwright-seatgeek",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "npx playwright test",
    "testInBrowser": "npx playwright test --headed",
    "testInOneBrowser": "npx playwright test --workers=1 --headed",
    "testInTwoBrowsers": "npx playwright test --workers=2 --headed",
    "test:1": "npx playwright test --workers=1",
    "test:2": "npx playwright test --workers=2",
    "codegen": "npx playwright codegen",
    "show-trace-viewer": "npx playwright show-trace",
    "tests-with-run-grep": "npx playwright test --grep '@run' --workers=1 --headed"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@playwright/test": "^1.16.1",
    "@types/faker": "^5.5.9",
    "playwright": "^1.16.1"
  },
  "dependencies": {
    "allure-playwright": "^2.0.0-beta.13",
    "faker": "^5.5.3",
    "tslog": "^3.2.2"
  }
}

Describe the bug

The error occurs while an attempt to install Playwright through a Gitlab CI run.
My node_modules and package-lock.json are inside .gitignore file - so they generated only through the installation.
I use the npm install command to install the dependencies. Until version 1.16.1 it worked as well.
Are there any changes that were performed on the installation process?

@AlexKomanov
Copy link
Contributor Author

Update:
If I change the versions of dependencies of the playwright and the @playwright/test to 1.15.2 - it still triggers the error.

If I install the dependencies manually it works as well. I use the following script:
npm install -D @playwright/test@1.15.2 @types/faker playwright@1.15.2.
In this case, the installation works as well:
image

@mxschmitt
Copy link
Member

Which Node.js version are you using on your CI? Node.js 14+ is recommended.

@AlexKomanov
Copy link
Contributor Author

@mxschmitt
On my local station - I use the v14.16.1.
I'll check the version and will update in the additional comment.

@AlexKomanov
Copy link
Contributor Author

@mxschmitt
The version used by CI pipeline is v12.14.1.
I tested the versions.
If I use a manual script for playwright version 1.15.2 - it works as well.
npm install -D @playwright/test@1.15.2 @types/faker playwright@1.15.2.
If I use a manual script for playwright version 1.16.1 - it triggers an error.
npm install -D @playwright/test@1.16.1 @types/faker playwright@1.16.1.

Can the requirement for a minimal Node.js version be changed/fixed from your side? Or do I need to update the version?
In case the minimal version is required - maybe it needs to be mentioned in the documentation? Or maybe I missed something?

@16oh4
Copy link

16oh4 commented Oct 25, 2021

Also ran into the same problem as @AlexKomanov. Using node 12.7.0 based on the engines requirement on the playwright package.json

{
  "name": "playwright",
  "version": "1.17.0-next",
  "description": "A high-level API to automate web browsers",
  "repository": "github:Microsoft/playwright",
  "homepage": "https://playwright.dev",
  "engines": {
    "node": ">=12"
  },

Is node 12 supported? I'm on macOS 10.15.7 (Catalina)

@shirshak55
Copy link

My old project is also giving err. I don't know what happened tho.

error /home/quantum/Desktop/projects/mike/hellow/node_modules/playwright: Command failed.
Exit code: 1
Command: node install.js
Arguments: 
Directory: /home/quantum/Desktop/projects/mike/hellow/node_modules/playwright
Output:
/home/quantum/Desktop/projects/mike/hellow/node_modules/proper-lockfile/lib/lockfile.js:68
                return callback(Object.assign(new Error('Lock file is already being held'), { code: 'ELOCKED', file }));
                                              ^

Error: Lock file is already being held
    at /home/quantum/Desktop/projects/mike/hellow/node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/home/quantum/Desktop/projects/mike/hellow/node_modules/proper-lockfile/node_modules/graceful-fs/polyfills.js:299:20)
    at FSReqCallback.oncomplete (node:fs:199:5) {
  code: 'ELOCKED',
  file: '/home/quantum/.cache/ms-playwright'
}
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this 

@semanio
Copy link

semanio commented Oct 26, 2021

I tried this locally on Node.js v12.22.7 and get the same error:
image

@semanio
Copy link

semanio commented Oct 26, 2021

I tried this locally on Node.js v12.22.7 and get the same error: image

To be clear, we'd prefer running Node.js v14.x but gave v12.x a try after that fix was suggested on #9780.

Upon further inspection, it looks to be an issue when the playwright test files (at least for me) are executed by jest. Meaning, we never had the npm install issue with playwright v1.16.1.

To fix our situation, I scoped the playwright e2e folder out of the JEST test runner path/pattern and we are no longer having the issue (...Cannot find module ...) on Node.js v14.18.1.

@JoelEinbinder
Copy link
Contributor

These look like they should fixed via #9718

@AlexKomanov
Copy link
Contributor Author

@JoelEinbinder
The issue fixed as well.
Thanks a lot!!!!
image

@aramos18
Copy link

aramos18 commented Jul 5, 2022

This is the righway:
npm install -D @playwright/test@1.16.1 @types/faker playwright@1.16.1

The issue fixed as well.
Thanks a lot!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants