In this guide we will address a main reason why nodemon might not be working on your windows pc. It comes down to having the execution policy set to where nodemon is physically able to work. As you can see below the first time I tried to run nodemon on my computer I was greeted with
nodemon.ps1 cannot be loaded because running scripts is disabled on this system.
In the picture above you can see my failed attempt to running nodemon. Let’s get to the steps below to resolve this issue.
To figure out if your execution policy is the issue we need to open up an administrative PowerShell window. To do that search for PowerShell in the start menu, then right click on
Windows PowerShell and select
Run as administrator
Once the PowerShell window opens we need to check what our execution policy is set to. Type
Get-ExecutionPolicy then hit the enter key. In the screen shot below you can see mine is set to
Restricted and this is the exact reason why mine is not working.
We need to set the execution policy to
Unrestricted in order for nodemon to work. To do this type
Set-ExecutionPolicy Unrestricted then hit the enter key.
CAUTION: By setting the execution policy to unrestricted it can allow for other unintended and / or malicious scripts to run without your knowledge. Make sure you understand the risks before enabling.
If you decide to move forward with setting the execution policy to
Unrestricted, you will need to enter
y to the prompt, then hit the enter key. At this point you should be able to run nodemon. We can test by running
Get-ExecutionPolicy and seeing that it returns
Then we can test nodemon by trying to get its version
nodemon -v then hitting the enter key. If all went well, you should see the version of your nodemon.
As you can see setting ExecutionPolicy to Unrestricted can help when nodemon is not working. Did this solution work for you? Leave a comment below to let fellow readers know how this process went for you.
If you would like to suggest a new article or video to be released, please reach out via the Contact Page. I look forward to hearing your feedback and providing content that is helpful for you!