终端错误:nodemon.ps1
无法加载,因为该系统上禁用了运行脚本。了解更多
信息,请参阅about_Execution_Policies at
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.2
我有一个解决方案可以通过这种方式解决这个问题:
1. Open Windows PowerShell with Run as Administrator
2. Run this command: Set-ExecutionPolicy Unrestricted
这样就解决了问题,但是这样系统会显示安全风险警告。
我的问题:有没有其他方法可以解决这个问题而不存在安全风险?目标是使用nodemon
.
我建议使用RemoteSigned
相对于Unrestricted
,并将政策限制为CurrentUser
如果可能的话。
以管理员身份运行 Powershell,然后:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
远程签名 https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1#remotesigned:“Windows 服务器计算机的默认执行策略。”
除此之外,我不会太担心它,因为它并不是一种安全机制。请参阅此引用文档: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1#remotesigned
“执行策略不是限制用户的安全系统
行动。例如,用户可以通过键入以下内容轻松绕过策略
当无法运行脚本时,在命令行中显示脚本内容。
相反,执行策略帮助用户设置基本规则和
防止他们无意中违反这些规定。”
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)