运行TypeScript文件是出错

151 阅读1分钟

运行TypeScript文件是出错

全局安装了Typescript、json-server、sass等并运行环境,运行时报错: 例如:

tsc : 无法加载文件 C:\Users\watson\AppData\Roaming\npm\tsc.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的about_Execution_Policies。
所在位置 行:1 字符: 1

image.png 使用管理员的Windows PowerShell依旧是这样

解决办法:

  1. 以管理员运行Windows PowerShell , windows + x 选择以管理员运行Windows PowerShell。
  2. set-ExecutionPolicy RemoteSigned
  3. 选择确定 Y 回车就好了。