tsc : 无法加载文件 ...\npm\tsc.ps1 解决方案

允我心安 提交于 2020-08-07 19:38:15

今天在电脑上安装完 typescript 后,执行 tsc -v 命令查看版本后,报错。

错误提示: tsc : 无法加载文件 ...\npm\tsc.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=13517 0 中的 about_Execution_Policies。

> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine       Undefined

解决方法: 以 管理员 身份打开 PowerShell !

执行 输入命令 set-ExecutionPolicy RemoteSigned 选择 Y。

查看

> Get-ExecutionPolicy -List

        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser       Undefined
 LocalMachine    RemoteSigned

验证

tsc -v
# 结果是 Version 3.9.6

验证成功!

参考: https://blog.csdn.net/dujyong/article/details/106359483 https://www.cnblogs.com/huangmuwei/p/12112014.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!