yarn.ps1 Cannot be Loaded Because Running Scripts is Disabled on this System

Learn how to resolve the PowerShell execution policy error that prevents Yarn scripts from running on Windows systems.

Introduction

When trying to use Yarn on Windows, you might encounter the error “yarn.ps1 cannot be loaded because running scripts is disabled on this system.” This error occurs due to PowerShell’s default security settings that restrict script execution.

Prerequisites

  • Windows operating system
  • PowerShell
  • Node.js installed
  • Yarn package manager installed

Understanding the Error

The full error message typically looks like this:

yarn.ps1 cannot be loaded because running scripts is disabled on this system. 
For more information, see about_Execution_Policies at
https://go.microsoft.com/fwlink/?LinkID=135170

Solutions

Solution 1: Change Execution Policy Temporarily

Open PowerShell as Administrator and run:

# For current session only

Leave a Reply