3

I'm trying to run nodemon, but when I do, it gives me the following error:

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.

Daniel Zhang
  • 191
  • 2
  • 12

3 Answers3

7

I had the same issue, to resolve this:

  • open the Windows PowerShell in Administration Mode
  • type Get-ExecutionPolicy and press Enter

If the machine returns "Restricted"

  • type Set-ExecutionPolicy Unrestrictand press Enter
  • press: y

Now go to your terminal and try nodemon again.

Benedikt Kromer
  • 711
  • 6
  • 22
Riddhi
  • 87
  • 1
  • 4
2

Type Get-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, it will change the Get-ExecutionPolicy to RemoteSigned and allow you to run Nodemon.

Daniel Zhang
  • 191
  • 2
  • 12
0

Try to open Windows powerShell via cmd cmd => PowerShell_ISE

in the Powershell Type this PowerShell => Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser click yes

then try to open your nodemon again, it should be working well Good luck