Error on terminal: 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.
I have a solution to fix the issue by this way
That solves the issue, but this way the system shows Security Risk Warning. My question: Is there any other way to solve this without security risk? Target is to use nodemon.
I'd recommend using RemoteSigned as opposed to Unrestricted, and limiting the policy to the CurrentUser if possible.
Run Powershell as Admin, and then:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
RemoteSigned: "The default execution policy for Windows server computers."
Other than that, I wouldn't worry about it too much, as it's not intended to be a security mechanism. See this quote from the docs:
"The execution policy isn't a security system that restricts user actions. For example, users can easily bypass a policy by typing the script contents at the command line when they cannot run a script. Instead, the execution policy helps users to set basic rules and prevents them from violating them unintentionally."
For those who are not aware of how to solve this error using Windows PowerShell
Get-ExecutionPolicy
# You should get 'Restricted'
Set-ExecutionPolicy Unrestricted
Get-ExecutionPolicy
# You should get 'Unrestricted'
nodemon 'filename.js'
Hope this would be helpful
Step 1 : Go to this location --> File C:\Users\Dell\AppData\Roaming\npm
Step 2 : Delete the nodemon.ps1 file and run the command.