【问题标题】:why nodemon is throwing some error in terminal?为什么 nodemon 在终端中抛出一些错误?
【发布时间】:2023-06-18 00:14:01
【问题描述】:

我正在学习 nodejs,遇到了 nodemon。我使用这个命令安装了 nodemon npm install -g nodemon 并且它安装成功,但是当我尝试使用命令 nodemon 运行 nodemon 时,它会在命令提示符下出现此错误。

nodemon : File C:\Users\callm\AppData\Roaming\npm\nodemon.ps1 cannot be loaded because running scripts is disabled on this system. For more 
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ nodemon index.js
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

【问题讨论】:

标签: node.js nodemon


【解决方案1】:

使用 RemoteSigned 而不是 Unrestricted,并尽可能将策略限制为 CurrentUser

以管理员身份运行 Powershell,然后:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

【讨论】: