0

Trying to learn TypeScript but I get an error

PS C:\Users\jogod\Desktop\TypeScript> tsc index.ts enter image description here

tsc : File C:\Users\jogod\AppData\Roaming\npm\tsc.ps1 cannot be loaded. The file C:\Users\jogod\AppData\Roaming\npm\tsc.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

  • tsc index.ts
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException      
      + FullyQualifiedErrorId : UnauthorizedAccess
    
    

I'm expecting that this command tsc index.ts will create another file of "index.js"

  • When learning anything about computer, especially programming languages, the first lesson is always to actually read and research error messages. This error message even conveniently gives you a link to everything you need to know and how to fix. – Daniel Jul 14 '23 at 00:47
  • https://stackoverflow.com/questions/58796490/tsc-ps1-cannot-be-loaded-because-running-scripts-is-disabled-on-this-system – joshua gonzales Jul 14 '23 at 00:54
  • Unfortunately, PowerShell defaults to _preventing_ execution of script files (`*.ps1`) in workstation editions of Windows, necessitating a change in [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Execution_Policies) to allow their execution. See the linked duplicate for details. – mklement0 Jul 14 '23 at 02:54

0 Answers0