0

I just made a fresh project.When I entered ng serve then the project is running fine.But,I tried to make a class.ts file using :

ng  g class common/book --spec false

I got this error:

ng : File C:\Users\AshwinPC\AppData\Roaming\npm\ng.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
+ ng  g class common/book --spec false
+ ~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException

So,i searched for the problem,and I got the solution, to set in powershell as run as administrator as:

C:\WINDOWS\system32>powershell Set-ExecutionPolicy RemoteSigned

C:\WINDOWS\system32>

Again I,saw error as:

PS E:\angular-bookstore> ng g class common/book --spec false
Unknown option: '--spec'
Unknown option: 'false'

Can,someone tell me why this error is showing when just creating a class from visualstudio code ?

Random guy
  • 883
  • 3
  • 11
  • 32

1 Answers1

1

Use --spec flag so your command should be

ng g class common/book --spec=false

Try above code, I think this will help you out.