問(wèn)題描述:
tsc : 無(wú)法加載文件 C:\Users\Administrator\AppData\Roaming\npm\tsc.ps1蚁鳖,因?yàn)樵诖讼到y(tǒng)上禁止運(yùn)行腳本。
ts運(yùn)行錯(cuò)誤.png
PS D:\TypeScript_Study> cd ts
PS D:\TypeScript_Study\ts> cd .\day01\
PS D:\TypeScript_Study\ts\day01> tsc hello.ts
tsc : 無(wú)法加載文件 C:\Users\Administrator\AppData\Roaming\npm\tsc.ps1赁炎,因?yàn)樵诖讼到y(tǒng)上禁止運(yùn)行腳本醉箕。有關(guān)詳細(xì)信息,請(qǐng)參閱 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies徙垫。
所在位置 行:1 字符: 1
+ tsc hello.ts
+ ~~~
+ CategoryInfo : SecurityError: (:) []讥裤,PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
解決
-
以管理員身份打開(kāi) Windows PowerShell
PowerShell.png 輸入命令 set-ExecutionPolicy RemoteSigned
set-ExecutionPolicy RemoteSigned
輸入命令.png
-
輸入 Y 即可
輸入Y.png -
再次運(yùn)行 tsc hello.ts
tsc.png