gpt4 book ai didi

node.js - 如何修复错误 - nodemon.ps1 无法加载,因为在此系统上禁用了运行脚本,(没有安全风险)?

转载 作者:行者123 更新时间:2023-12-02 22:12:44 31 4
gpt4 key购买 nike

终端错误:无法加载 nodemon.ps1,因为在此系统上禁用了运行脚本。更多
信息,请参阅 https://go.microsoft.com/fwlink/?LinkID=135170 上的 about_Execution_Policies。
我有一个通过这种方式解决问题的解决方案

  • 以管理员身份运行打开 Windows PowerShell
  • 运行此命令:Set-ExecutionPolicy Unrestricted

  • 这解决了问题,但这样系统会显示安全风险警告。我的问题:有没有其他方法可以在没有安全风险的情况下解决这个问题?目标是使用 nodemon。

    最佳答案

    我建议使用 RemoteSigned而不是 Unrestricted ,并将策略限制为 CurrentUser如果可能的话。
    以管理员身份运行 Powershell,然后:

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
    RemoteSigned :“Windows 服务器计算机的默认执行策略。”

    除此之外,我不会太担心它,因为它不是一种安全机制。请参阅来自 the docs: 的引用

    "The execution policy isn't a security system that restricts useractions. For example, users can easily bypass a policy by typing thescript contents at the command line when they cannot run a script.Instead, the execution policy helps users to set basic rules andprevents them from violating them unintentionally."

    关于node.js - 如何修复错误 - nodemon.ps1 无法加载,因为在此系统上禁用了运行脚本,(没有安全风险)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63423584/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com