ng serve –open not working from Powershell and VS terminal(Powershell)

  angular-cli, powershell, visual-studio, windows

When I faced this problem, by that time I have already tried triggering this command from Pwershell, both admin and non admin

Got this error:

ng : File C:UsersvishiAppDataRoamingnpmng.ps1 cannot be loaded because running scripts is disabled on this system. For more information,
see about_Execution_Policies at https:/
At line:1 char:1

  • ng serve –open
    • CategoryInfo : SecurityError: (:) [], PSSecurityException
    • FullyQualifiedErrorId : UnauthorizedAccess

Then I tried running from CMD as this issue was because of security policies applied on Powershell, then CMD showed this error:

”’The new command requires to be run outside of a project, but a project definition was found at C:UsersvishiImprovAppangular.json".

After executing following command:

Security policy got updated, and then I triggered "ng serve –open" from VS terminal and then it worked.

Source: Windows Questions