0

This is the error message

yarn : File C:\Users\Admin\AppData\Roaming\npm\yarn.ps1 cannot be loaded 
because running scripts is disabled on this system. For more 
information, see about_Execution_Policies at 
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ yarn
+ ~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
James Z
  • 12,209
  • 10
  • 24
  • 44
derick haron
  • 1
  • 1
  • 3
  • This seems relevant: [PowerShell says "execution of scripts is disabled on this system."](https://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system) – DBS May 17 '22 at 12:46

1 Answers1

1

For those who are not aware of how to solve this error using Windows PowerShell

  1. Open PowerShell (Run As Administrator)
  2. Check the current execution policy using this command
    Get-ExecutionPolicy
    # You should get 'Restricted'
  1. Run this command to make it 'Unrestricted'
  Set-ExecutionPolicy Unrestricted
  1. Check again whether execution policy changed by running this command

    Get-ExecutionPolicy
    You should get 'Unrestricted'
    
  2. Now try to run nodemon on your project

   nodemon 'filename.js'

Hope this would be helpful