[BUG] Cannot start playwright test v1.16 if installed using Yarn
Context:
- Playwright Version: 1.16.1
- Operating System: Mac
- Node.js version: 12.18.2
- Browser: Chromium
- Extra: -

β e2e-tests git:(test-controller-api-client) β yarn add @playwright/test --save
yarn add v1.22.15
[1/4] π Resolving packages...
[2/4] π Fetching packages...
[3/4] π Linking dependencies...
[4/4] π¨ Building fresh packages...
success Saved lockfile.
success Saved 86 new dependencies.
info Direct dependencies
ββ @playwright/[email protected]
info All dependencies
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @babel/[email protected]
ββ @playwright/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ @types/[email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
ββ [email protected]
β¨ Done in 2.74s.
β e2e-tests git:(test-controller-api-client) β yarn run playwright test -g "Login"
yarn run v1.22.15
$ /e2e-tests/node_modules/.bin/playwright test -g Login
Please install @playwright/test package to use Playwright Test.
npm install -D @playwright/test
error Command failed with exit code 1.
npx: installed 1 in 0.988s
## System:
- OS: macOS 11.6
- Memory: 27.58 MB / 16.00 GB
## Binaries:
- Node: 12.18.2 - ~/.nvm/versions/node/v12.18.2/bin/node
- Yarn: 1.22.15 - /usr/local/bin/yarn
- npm: 6.14.5 - ~/.nvm/versions/node/v12.18.2/bin/npm
## Languages:
- Bash: 3.2.57 - /bin/bash
Code Snippet Test code not needed - framework does not start at all, so i am just leaving commands to recreate issue.
yarn install @playwright/test --save
yarn run playwright test
Describe the bug
In latest version 1.16 it is impossible to start framework using Yarn as it does not detect being installed after successful installation.
Do you maybe have an old version of playwright installed? You don't need playwright when using @playwright/test.
The following worked for me:
yarn init -y
yarn add @playwright/test
# create some test file
npx playwright test
@mxschmitt I have upgraded currently installed v15 using yarn upgrade @playwright/test --latest
I've also tried yarn remove @playwright/test and then yarn add @playwright/test --save - still does not work.
In your example, you are using npx playwright test - we are using yarn to install packages, and we are using yarn run .... That being said npx playwright test throws the same error.
{
"name": "e2e-tests",
"version": "1.0.0",
"main": "index.js",
"license": "CLOSED SOURCE",
"private": true,
"scripts": {
"test:all": "yarn run playwright test --headed"
},
"dependencies": {
"@playwright/test": "^1.16.1",
"axios": "^0.24.0",
"chalk": "^4.1.2",
"nyc": "^15.1.0"
},
"devDependencies": {
"prettier": "^2.4.1"
}
}
Can you verify if there is a node_modules/playwright/package.json? (and if so, which version this is?)
Or create a small repro in form of a small GitHub repository?
I am facing the same issue: getting following message : Please install @playwright/test package to use Playwright Test. What else I need to try now ?

OS: Windows 10 Home Node version: v12.18.4 Playwright version : ^1.16.1
Please find my Package.json
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "npx playwright test/test.js"
},
"devDependencies": {
"@playwright/test": "^1.16.1"
}
}
Test is my root folder and I have installed Playwright at this location. Now I have nested into below folder path, not sure if that is of any help ?

Do you have a C://Test//node_modules//playwright folder? If so, which version is there? C://Test//node_modules//playwright//package.json?
Could you provide full reproducible steps? I tried the following which worked for me:
yarn init -y
yarn add @playwright/test
# create some test file
npx playwright test
# or
yarn run playwright test
@mxschmitt Thank you, I have provided all my version details in my details above, I will mention again below...
OS: Windows 10 Home
Node version: v12.18.4
Playwright version : ^1.16.1
Please find my Package.json
{
"name": "test",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"test": "npx playwright test/test.js"
},
"devDependencies": {
"@playwright/test": "^1.16.1"
}
}
npm install --global yarn
mkdir test
cd test
yarn init -y
yarn add @playwright/test
// add some test file
yarn run playwright test
I tried the following which works for me on Windows, please try to delete your Β΄node_modulesΒ΄ folder and install your dependencies again. Also make sure that you don't have an old playwright or playwright-core dependency somewhere.
Closing since it seems stale and solved. If you still encounter issues, please create a new issue with a full repro (Docker preferred to have it isolated).