code

npm에서 nodemon을 찾을 수 없음

codestyles 2020. 11. 19. 08:14
반응형

npm에서 nodemon을 찾을 수 없음


nodemon는 NPM 스크립트 (예 : 오프 실행되지 않습니다 : 나는 문제가 npm start),
하지만 경우 nodemon이 정상적으로 실행 nodemon, 고궁 박물원 스크립트 외부 명령 줄에서 호출됩니다.

$ nodemon server.js
14 Feb 22:59:51 - [nodemon] v1.3.7
14 Feb 22:59:51 - [nodemon] to restart at any time, enter `rs`
14 Feb 22:59:51 - [nodemon] watching: *.*
14 Feb 22:59:51 - [nodemon] starting `node server.js`

npm 스크립트에서 호출되는 방법 :

package.json

{
...
  "scripts": {
    "start": "nodemon server.js"
  }
}

npm 시작 스크립트가 실행될 때 :

$ npm start
> aaa@0.0.1 start /home/akul/Documents/aaa
> nodemon server.js

sh: 1: nodemon: not found

npm ERR! Linux 3.13.0-45-generic
npm ERR! argv "node" "/home/akul/npm-global/bin/npm" "start"
npm ERR! node v0.12.0
npm ERR! npm  v2.5.0
npm ERR! code ELIFECYCLE
npm ERR! aaa@0.0.1 start: `nodemon server.js`
npm ERR! Exit status 127
npm ERR! 
npm ERR! Failed at the aaa@0.0.1 start script 'nodemon server.js'.
npm ERR! This is most likely a problem with the aaa package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     nodemon server.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls aaa
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/akul/Documents/aaa/npm-debug.log

해결책을 찾고 있었지만 해결책을 찾지 못했습니다.


package.json에 nodemon을 추가하여이 문제를 해결할 수 있습니다.

npm install nodemon --save

nodemon이 /node_modules/.bin에 없을 때 문제가 발생합니다.


설치된 글로벌 패키지를 확인하십시오 npm list -g --depth=0. 찾을 수없는 경우 nodemon-플래그 -g또는 --save-dev. .NET 에만 사용 되므로 nodemonflag로 설치하지 마십시오 .--savenodemondevelopment


현재 프로젝트 디렉토리에서 다음을 실행하십시오.

npm install nodemon --save //save in package.json so that the following code cam find your nodemon

그런 다음 package.json 파일의 "scripts"아래 에 "start": "nodemon app.js"(또는 진입 점이 무엇이든)
를 추가하면 다음과 같이 표시됩니다.

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon app.js"
}

그런 다음 실행

npm start

그것은 복잡한 PATH 설정을 피하고 내 Mac에서 작동하므로
도움이 될 수 있습니다.)


nodemon다음 명령을 사용하여 전역 적으로 설치하십시오 . 내 컴퓨터에서 작동하며 시스템에서도 작동 할 것이라고 확신합니다.

npm install nodemon -g --save

때로는 전역으로 설치할 수있는 권한이 있어야합니다. 다음 명령을 사용하여 쉽게 할 수 있습니다.

  1. LINUX UBUNTU에서 : sudo npm install nodemon -g --save

  2. Fedora에서 :

    a) su
    b)npm install nodemon -g --save


수정 방법은 다음과 같습니다.

다음을 사용하여 nodemon을 설치했을 때 npm install nodemon -g --save전역 npm 패키지의 경로가 PATH 변수에 없습니다.

$ PATH 변수에 추가하면 수정됩니다.

Edit the ~/.bashrc file in your home folder and add this line :-

export PATH=$PATH:~/npm

Here "npm" is the path to my global npm packages . Replace it with the global path in your system


Try to install nodemon globally.

sudo npm install -g nodemon

You have to simply installed it globally. npm install -g nodemon


This solution had worked for me:

I assume that you have installed nodemon globally. If it's done follow this steps:

open your .bash_profile file:

nano .bash_profile

past this to add a new alias in your bash profile:

alias nodemon='~/.npm-global/lib/node_modules/nodemon/bin/nodemon.js'

Now you can use nodemon command anywhere.


heroku runs in a production environment by default so it does not install the dev dependencies.

if you don't want to reinstall nodemon as a dependency which I think shouldn't because its right place is in devDependencies not in dependencies.

instead, you can create two npm script to avoid this error by running nodemon only in your localhost like that:

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "node app.js",
    "start:dev": "nodemon --watch"
},

and when you want to run the project locally just run in your terminal npm run start:dev and it will load app.js by nodemon.

while in heroku npm start runs by default and load app.js from a normal node command and you get rid of that error.


I had this problem and even after I have used the command npm install nodemon --save in my application, I still had problem with nodemon.

I just resolved after I installed nodemon globally, using the command:npm install nodemon -g



Had the same problem otherwise was just working fine a day ago. Very simple fix first check if nodemon exists on your system globally or not

To check

npm list -g --depth=0

If you don't see then install it npm install -g nodemon (g stands for globally)
If you see it still doesn't work then you need to configure environment variable I use Windows OS. On Windows navigate to

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. For me node was installed in C:..\Roaming\npm and for you if the PATH is different, you will put in whatever applcable.


First install nodemon to your working folder by

npm install nodemon

Add the path of nodemon to the path variable of Environment Variable of System environment. In my case the path of nodemon was.

C:\Users\Dell\Desktop\Internship Project\schema\node_modules\.bin

It worked for me.


You can always reinstall Node.js. When I had this problem, I couldn't fix it, but all I did was update the current version of Node. You can update it with this link: https://nodejs.org/en/download/


I wanted to add how I fixed this issue, as I had to do a bit of mix and match from a few different solutions. For reference this is for a Windows 10 PC, nodemon had worked perfectly for months and then suddenly the command was not found unless run locally with npx. Here were my steps -

  1. Check to see if it is installed globally by running npm list -g --depth=0, in my case it was installed, so to start fresh...
  2. I ran npm uninstall -g nodemon
  3. Next, I reinstalled using npm install -g --force nodemon --save-dev (it might be recommended to try running npm install -g nodemon --save-dev first, go through the rest of the steps, and if it doesn't work go through steps 2 & 3 again using --force).
  4. Then I checked where my npm folder was located with the command npm config get prefix, which in my case was located at C:\Users\username\AppData\Roaming\npm
  5. I modified my PATH variable to add both that file path and a second entry with \bin appended to it (I am not sure which one is actually needed as some people have needed just the root npm folder and others have needed bin, it was easy enough to simply add both)
  6. Finally, I followed similar directions to what Natesh recommended on this entry, however, with Windows, the .bashrc file doesn't automatically exist, so you need to create one in your ~ directory. I also needed to slightly alter how the export was written to be export PATH=%PATH%;C:\Users\username\AppData\Roaming\npm; (Obviously replace "username" with whatever your username is, or whatever the file path was that was retrieved in step 4)

I hope this helps anyone who has been struggling with this issue for as long as I have!


--save, -g and changing package.json scripts did not work for me. Here's what did: running npm start (or using npx nodemon) within the command line. I use visual studio code terminal. When it is successful you will see this message:

[nodemon] 1.18.9
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node app.js

Good luck!


NPM is used to manage packages and download them. However, NPX must be used as the tool to execute Node Packages

Try using NPX nodemon ...

Hope this helps!


My nodemon vanished after installing babel (why?).

Tried a lot of stuff. Here is how I solved it:

sudo npm i -g nodemon

Just reinstall it with sudo. Yeah.

참고URL : https://stackoverflow.com/questions/28517494/nodemon-not-found-in-npm

반응형