tsc命令无权限,无法执行tsc hello.ts,如何解决?
详细报错如下:
tsc : File C:\Users\86136\AppData\Roaming\npm\tsc.ps1 cannot be loaded because running scripts
is disabled on this system. For more information, see about_Execution_Policies at https:/go.m
icrosoft.com/fwlink/?LinkID=135170.
At line:1 char:1
tsc hello.ts
CategoryInfo : SecurityError: (😃 [], PSSecurityException
FullyQualifiedErrorId : UnauthorizedAccess
以上大致意思就是执行tsc命令没有权限。
解决方案
第一步:管理员身份运行windows powershell
第二步:输入set-ExecutionPolicy RemoteSigned选择 A 或者 Y,回车。
第三步:测试