Skip to content

Instantly share code, notes, and snippets.

@imshaiknasir
Last active January 13, 2026 19:15
Show Gist options
  • Select an option

  • Save imshaiknasir/797297a850fcd2c90d7989524c5272ad to your computer and use it in GitHub Desktop.

Select an option

Save imshaiknasir/797297a850fcd2c90d7989524c5272ad to your computer and use it in GitHub Desktop.
PowerShell blocks the `npm init playwright` command due to a restrictive execution policy, preventing the unsigned `npm.ps1` script from running. Adjust the policy temporarily using `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass` to resolve.

Here are the steps to fix the issue persistently:

  1. Open PowerShell as Administrator:

    • Search for "PowerShell" in the Start menu.
    • Right-click it.
    • Select Run as Administrator.
  2. Check Current Execution Policy:

    • Run this command in PowerShell: Get-ExecutionPolicy -List
    • This shows policies for different scopes.
  3. Set Persistent Execution Policy:

    • To allow scripts for your user account persistently: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Bypass

    • This setting applies only to your user account.

    • It remains active after you restart your computer.

    • Answer 'Y' (Yes) if prompted to confirm the change.

    • Alternatively, to allow scripts for all users persistently (requires administrator privileges): Set-ExecutionPolicy -Scope LocalMachine -ExecutionPolicy Bypass

    • This setting applies to all users on the computer.

    • It remains active after restarts.

    • Answer 'Y' (Yes) if prompted.

    • Choose the scope (CurrentUser or LocalMachine) that best fits your needs. CurrentUser is often sufficient and safer.

  4. Run Your Command Again:

    • Retry your npm init playwright command.
    • It should run without the execution policy error.

Additional Notes:

  • Using Bypass lets any script run. Understand the security risk before proceeding.
  • If problems continue, consider reinstalling Node.js. Get the latest version from the Node.js website.
@eilupeju-collab

Copy link
Copy Markdown

where is the powershell?

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