7

I have verified on my windows that I have Powershell - the latest version installed.

When I run the command from the Playwright website :

pwsh bin/Debug/netX/playwright.ps1 install

I get the following error : 'argument bin/Debug/netX/playwright.ps1' is not recognized as the name of a script file. and I have been unable to find a work around. *

*to add more the error

3
  • 3
    Presumably from the page you were looking at: "Install required browsers by replacing netX with the actual output folder name, e.g. net6.0" conclusion: your path is wrong because you didn't swap out "netX". Commented Jan 5, 2023 at 15:42
  • 1
    The comment of @PixelPlex (netx -> net6.0) is the right answer Commented Mar 22, 2023 at 8:55
  • I'll add it as an answer, so it's clear what actually solved the issue. Commented Mar 23, 2023 at 15:25

4 Answers 4

16

There is an existing GitHub issue regarding this problem. To summarize the solutions listed there, here are a few things you can try:

Install the PowerShell tool:

dotnet tool install --global PowerShell

Or, Update the PowerShell tool:

dotnet tool update --global PowerShell

Or, Install PowerShell Core from the Microsoft website

Then, you can try to install playwright CLI and the browsers.

dotnet tool install --global Microsoft.Playwright.CLI
playwright install

If none if these solves your problem, kindly share in the comments.

Sign up to request clarification or add additional context in comments.

3 Comments

Hi md. Abu Taher, I ran 'dotnet tool install --global PowerShell' successfully but the 2nd command would only work as follows: 'dotnet tool install --global Microsoft.Playwright.CLI' if I added 'playwright install' I get this output: 'unrecognized command or argument 'playwright' or if only ran 'playwright install' i got 'couldn't find project using Playwright, Ensure a project or a solution exists in 'C:\Windows\system32' do you suggest anything else? I looked at that githb link too, thanks.
i verified that my env variables for dot net are correct based on following the github thread
You seem to be running the commands in the wrong folder. Make sure to cd into your project folder before you continue.
1

I have the same issue then i fixed it by changing the command to pwsh bin/Debug/net7.0/playwright.ps1 install

pwsh is the powershell bin/Debug/net7.0/playwright.ps1 is the file path of that PowerShell script

Comments

1

That code snippet you posted in your question can be found on the Playwright website on a introduction guide.

If you read the instructions carefully, it says the following at point 4 of the numbered list: "Install required browsers by replacing netX with the actual output folder name". Here, "netX" stands for the .net framework version you use for your project.

If your project targets the .net 6 framework, than your command should be:

pwsh bin/Debug/net6/playwright.ps1 install

Comments

0

If your project begins with the word 'playwright' then playwright.ps1 will not be installed when you ran 'dotnet build'. Don't ask me why... I had the same problem and could see playwright.ps1 was not appearing in the directory after building, so I renamed my project on a hunch and then I could see the playwright.ps1 file being installed after building

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.