-1

Hi I want to start a new Angular project but I have the following problem. please guide me.

error message

Error message: ng: File C: \ Users \ installer \ AppData \ Roaming \ npm \ ng.ps1 cannot be loaded. 
The file C: \ Users \ installer \ 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 new firstapp + ~~ + CategoryInfo: SecurityError: (:) [], 
PSSecurityException + FullyQualifiedErrorId: UnauthorizedAccess.
Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
Aliakbar
  • 88
  • 1
  • 9
  • try use cmd with administrator privilege if it going to work – Muhammed Albarmavi Mar 06 '20 at 09:51
  • 2
    Welcome to Stack Overflow! Please take the [tour], have a look around, and read through the [help], in particular [*How do I ask a good question?*](/help/how-to-ask) Post code, error messages, markup, etc. **as text**, not as a *picture* of text. Why: http://meta.stackoverflow.com/q/285551/157247 – T.J. Crowder Mar 06 '20 at 09:51
  • 1
    If you're just starting you might want to start with Angular 9. – mamichels Mar 06 '20 at 09:53
  • check this https://stackoverflow.com/questions/50198408/ng-new-has-stopped-working-after-updating-to-angular-6 – Sanjay Lohar Mar 06 '20 at 09:55
  • https://tecadmin.net/powershell-running-scripts-is-disabled-system/ – BartoszTermena Mar 06 '20 at 09:56
  • 1
    Error message: ng: File C: \ Users \ installer \ AppData \ Roaming \ npm \ ng.ps1 cannot be loaded. The file C: \ Users \ installer \ 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 new firstapp + ~~ + CategoryInfo: SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId: UnauthorizedAccess. I've run run as adminstor. – Aliakbar Mar 06 '20 at 09:59
  • 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:24

2 Answers2

2

I start to get this problem recently I found out you need to run this on powershell

 Set-ExecutionPolicy RemoteSigned

The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y

then answer as Y

check this answer for more information

Muhammed Albarmavi
  • 23,240
  • 8
  • 66
  • 91
0

Run below command in Powershell terminal.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser