'when i type command at windows terminal http-server

when i type command at windows terminal http-server following error occured error http-server http-server : File C:\Users\RKanth\AppData\Roaming\npm\http-server.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. At line:1 char:1 + http-server + ~~~~~~~~~~~ + CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess



Solution 1:[1]

  1. Open PowerShell by Run as Administrator

  2. Run the following command:

    Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

  3. Confirm with ‘Y’

Solution 2:[2]

  1. Open PowerShell by Running as Administrator using the windows search bar.
  2. Run the following command: Get-ExecutionPolicy
  3. Then you can See: Restricted
  4. Again run the following command: Set-ExecutionPolicy Unrestrict
  5. Press y
  6. Now you can Run again the following command and check: Get-ExecutionPolicy
  7. Then you can See: Unrestricted
  8. Done!!!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Adrian Mole
Solution 2 Malintha Nilhan