美文网首页TypeScript
TS tsc : 无法加载文件 C:\Users\Admin

TS tsc : 无法加载文件 C:\Users\Admin

作者: Rinaloving | 来源:发表于2022-08-31 13:16 被阅读0次
    问题描述:

    tsc : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\tsc.ps1,因为在此系统上禁止运行脚本。


    ts运行错误.png
    PS D:\TypeScript_Study> cd ts
    PS D:\TypeScript_Study\ts> cd .\day01\
    PS D:\TypeScript_Study\ts\day01> tsc hello.ts
    tsc : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\tsc.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
    所在位置 行:1 字符: 1
    + tsc hello.ts
    + ~~~
        + CategoryInfo          : SecurityError: (:) [],PSSecurityException
        + FullyQualifiedErrorId : UnauthorizedAccess
    
    解决
    1. 以管理员身份打开 Windows PowerShell


      PowerShell.png
    2. 输入命令 set-ExecutionPolicy RemoteSigned

    set-ExecutionPolicy RemoteSigned
    
    输入命令.png
    1. 输入 Y 即可


      输入Y.png
    2. 再次运行 tsc hello.ts


      tsc.png

    相关文章

      网友评论

        本文标题:TS tsc : 无法加载文件 C:\Users\Admin

        本文链接:https://www.haomeiwen.com/subject/mszjnrtx.html