Table of contents
1. Problem description
When using tsc to compile ts files on the WebStorm terminal, the console reports the following errors:
tsc : Could not load file E:\MyDesktop\test\part1\tsc.ps1 because running scripts is prohibited on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
Location Line: 1 Character: 1
Two, the solution
After testing, this method is effective for both WebStorm and VSCode.
1. Right-click the compiler -> Properties -> Compatibility -> Run the program as an administrator (tick)
2. Open webstorm/vscode, enter the terminal, enter and execute the following commands in sequence:
get-ExecutionPolicy
set-ExecutionPolicy RemoteSigned
get-ExecutionPolicy
3. Finally, just execute tsc demo.ts. demo.ts is the name of the file to be compiled. After the compilation is completed, the demo.js file will appear.