Tag Archives: TSC Compile TS File Error

[Solved] TSC Compile TS File Error: TSC: the file cannot be loaded because running scripts is prohibited on this system;

An error is reported when compiling the TS file with TSC.TSC: the file cannot be loaded because running scripts is prohibited on this system; SecurityError

An error is reported when compiling the TS file with the TSC command in the vscode console or windows PowerShell.TSC: the file cannot be loaded because running scripts is prohibited on this system; SecurityError

Run PowerShell as an administrator and execute the command set executionpolicy remotesigned to change the execution policy of PowerShell to remotesigned

Use the Win + x shortcut key to open the shortcut window and click windows PowerShell (administrator) (a) to open windows PowerShell

Run the set executionpolicy remotesigned command, and select y or a when asking to change the execution policy

Reopen vscode or windows PowerShell, and use TSC - V to stop reporting errors. You can also compile TS files.