简体   繁体   English

Nodemon 命令不起作用 未经授权的访问

[英]Nodemon Command Not Working Unauthorized Access

I'm trying to run nodemon, but when I do, it gives me the following error:我正在尝试运行 nodemon,但是当我这样做时,它给了我以下错误:

nodemon : File C:\Users\dyzha\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 app.js
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityExcep  
   tion
    + FullyQualifiedErrorId : UnauthorizedAccess

I've tried uninstalling it and reinstalling it, npm install -g nodemon , and npm install nodemon --save-dev .我试过卸载它并重新安装它, npm install -g nodemonnpm install nodemon --save-dev

I had the same issue, to resolve this:我有同样的问题,要解决这个问题:

  • open the Windows PowerShell in Administration Mode在管理模式下打开 Windows PowerShell
  • type Get-ExecutionPolicy and press Enter键入Get-ExecutionPolicy并按Enter

If the machine returns "Restricted"如果机器返回“受限”

  • type Set-ExecutionPolicy Unrestrict and press Enter键入Set-ExecutionPolicy Unrestrict并按Enter
  • press: y按: y

Now go to your terminal and try nodemon again.现在 go 到您的终端并再次尝试nodemon

Type Get-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser , it will change the Get-ExecutionPolicy to RemoteSigned and allow you to run Nodemon.键入Get-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser ,它将Get-ExecutionPolicy更改为RemoteSigned并允许您运行 Nodemon。

Try to open Windows powerShell via cmd cmd => PowerShell_ISE尝试通过 cmd ZDFFF0A7FA1A55C8C1A4966C19ISEF6DA45_2Z => PowerShell_ISE打开 Windows powerShell

in the Powershell Type this PowerShell => Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser click yes在 Powershell 中键入此 PowerShell => Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser单击yes

then try to open your nodemon again, it should be working well Good luck然后尝试再次打开你的nodemon ,它应该运行良好祝你好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM