2

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
  • 154
  • 2
  • 10

2 Answers2

4

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
  • 656
  • 6
  • 21
Riddhi
  • 57
  • 4
0

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

Daniel Zhang
  • 154
  • 2
  • 10