Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do I get "nodemon cannot be loaded" in my VS Code terminal?

I installed Nodemon locally and globally, but in both cases I get the same error:

Nodemon : File C:\Users\xxx\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 Books.js
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess. 

How to fix it?

like image 802
roman Avatar asked Sep 20 '25 05:09

roman


2 Answers

Hello please follow these you can solve this,
-> open Admin PowerShell
type these commands.
1)Set-ExecutionPolicy RemoteSigned
2)Set-ExecutionPolicy Unrestricted
3)Get-ExecutionPolicy
4)Exit

maybe your problem solve

like image 65
Takbeer Ali Avatar answered Sep 22 '25 03:09

Takbeer Ali


I have encountered this problem before and solved it like this:-

go to package.json, then attachment this to scripts:-

"start": "node app", "dev": "nodemon app"

it will be like this

"scripts": {
"start": "node app",
"dev": "nodemon app"},

then write in terminal npm run dev

note: app refer to the file name of your entry point

like image 25
Hamza Alshanti Avatar answered Sep 22 '25 03:09

Hamza Alshanti