简体   繁体   中英

nodemon not working in windows 10

I successfully installed nodemon on my local machin, however it is giving me below error message when I run the code.

here is the error detail

The term 'nodemon' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ nodemon
+ ~~~~~~~
    + CategoryInfo          : ObjectNotFound: (nodemon:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

I had the same problem,simple fix first check if path exists on your Environment variable path or not

To check

Control panel>System>Advanced System Settings>Environment Variables>double-click on PATH

Now check if you have this PATH C:\\Users\\yourUsername\\AppData\\Roaming\\npm

If not, you will see some existing paths, just append to it separating with semicolon. That's it! Worked for me.

add PATH C:\\Users\\yourUsername\\AppData\\Roaming\\npm in Environment Variables path

Try this for Windows

Open PowerShell and enter the following commands.

A) Set-ExecutionPolicy RemoteSigned

B) Set-ExecutionPolicy Unrestricted

C) Get-ExecutionPolicy

D) Exit

这对我有用:这应该将策略限制为当前用户。

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

我找到了一种解决方法,只需进入 package.json(在您键入 npm init 后创建的文件)并在“脚本”下放置start: "nodemon <filename>" ,现在每次您在终端中键入 npm start nodemon 应该以 ur 文件开头

I had the same problem and nothing worked. Finally after spending hours found the solution.

If you are using Windows, follow these steps=>

On start menu, search "cmd" , and then right click and run as administrator. Now you'll have the administrator command prompt running. Now, type these instructions =>

1)PowerShell Set-ExecutionPolicy RemoteSigned

2)PowerShell Set-ExecutionPolicy Unrestricted

3)PowerShell Get-ExecutionPolicy

4)PowerShell Exit

Now Try nodemon [your node app] Now that your nodemon should be working fine. Also make sure you have globally installed nodemon npm install -g nodemon. Thanks!

我在全局安装了 nodemon,它开始工作:

npm install -g nodemon

I encountered this problem too.

I installed nodemon in a local directory and tried to run nodemon index.js

then I got the above error

I ran npx nodemon index.js and the server started successfully

ON WINDOWS PC as ADMIN

Open PowerShell and enter:

A)Set-ExecutionPolicy RemoteSigned (yes)

B)Set-ExecutionPolicy Unrestricted (yes)

C)Get-ExecutionPolicy

D)Exit

Might be that it still doesn't work in your IDE. If it happens just close and re-open your IDE and try to run it again.

Another option can be that you have to go to your cmd (windows + r) and run: npm install -g nodemon

Those three steps should solve the problem in any case.

In cmd type npx nodemon server.js and then it will start...

For example,
[nodemon] 2.0.15
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node server.js

This was giving me issues as well on Windows 10. My solution that worked:

  1. run:

npm i nodemon --save-dev

  1. In package.json add this (main is whatever file you need to watch):

"main": "app.js",
"scripts":{"watch": "nodemon./app.js"}

  1. run:

npm run watch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM