终端错误: nodemon.ps1
无法加载,因为在此系统上禁用了运行脚本。有关详细信息,请参阅 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2 上的 about_Execution_Policies
我有一个解决方案来解决这个问题:
1. Open Windows PowerShell with Run as Administrator
2. Run this command: Set-ExecutionPolicy Unrestricted
这解决了问题,但这样系统会显示安全风险警告。
我的问题:有没有其他方法可以在没有安全风险的情况下解决这个问题?目标是使用 nodemon
。
原文由 CyberKing 发布,翻译遵循 CC BY-SA 4.0 许可协议
我建议使用
RemoteSigned
而不是Unrestricted
,并尽可能将策略限制为CurrentUser
。以管理员身份运行 Powershell,然后:
RemoteSigned :“Windows 服务器计算机的默认执行策略。”
除此之外,我不会太担心它,因为它不打算成为一种安全机制。请参阅 文档中的此引用: