Error while compiling ts file with TSC in vscode, TSC: cannot load file, because scripts are forbidden to run on this system. SecurityError

1. Install TS-Node globally

npm install -g ts-node
Copy the code

2. The solution is to open this as an administrator

  1. Take the set-executionPolicy remotescene and choose Y or A

4.tsc –init