0

ng : File C:\Users\Jothi\AppData\Roaming\npm\ng.ps1 cannot be loaded. The file C:\Users\Jothi Tamil\AppData\Roaming\npm\ng.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see about_Execution_Policies at https://go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1

  • ng --version
  • ~~
    • CategoryInfo : SecurityError: (:) [], PSSecurityException
    • FullyQualifiedErrorId : UnauthorizedAccess
Felix
  • 9,248
  • 10
  • 57
  • 89
jothi
  • 1
  • 1
  • 2
    Does this answer your question? [Why is my locally-created script not allowed to run under the RemoteSigned execution policy?](https://stackoverflow.com/questions/9742775/why-is-my-locally-created-script-not-allowed-to-run-under-the-remotesigned-execu) – marsh-wiggle Feb 20 '21 at 06:47
  • the link that you put here gives the answer. That's always a good start – Felix Feb 20 '21 at 06:52
  • Does this answer your question? [why am I suddenly getting: ng : File C:\Users\d\AppData\Roaming\npm\ng.ps1 cannot be loaded](https://stackoverflow.com/questions/72863930/why-am-i-suddenly-getting-ng-file-c-users-d-appdata-roaming-npm-ng-ps1-canno) – starball Jun 23 '23 at 19:23

2 Answers2

4

You should invoke following command to change ExecutionPolicy to RemoteSigned. Because default policy is Restricted, it prevents running of all script files.

$ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Maroon1
  • 114
  • 3
3
  1. Please open a command prompt run the following command

    set-ExecutionPolicy RemoteSigned -Scope CurrentUser

    enter image description here

  2. now run this command:

    Get-ExecutionPolicy

enter image description here

  1. View policies, by running this command:

    Get-ExecutionPolicy -list
    enter image description here

Sydney_dev
  • 1,448
  • 2
  • 17
  • 24