Node.JS : 오류 가져 오기 : [nodemon] 내부 시계 실패 : ENOSPC 시계
방금 운영 체제에 처음으로 설치 Node.js했습니다 Ubuntu 14.04. 나는 또한 설치했다 npm. 설치 과정의 다음 단계는 설치 nodemon였습니다. 이 모든 것이 잘 작동했습니다.
그러나 명령 줄 nodemon을 입력하여 실행 nodemon app.js하면 다음 오류가 발생합니다 ...
[nodemon] 1.8.1 [nodemon] to restart at any time, enterrs [nodemon] watching: *.* [nodemon] starting노드 app.js [nodemon] Internal watch failed: watch ENOSPC
오류 아래의 명령 행에서 ...
alopex@Alopex:~/Desktop/coding_dojo/week-9/javascript/node/testing_node$ Hello World
왜 이런 일이 발생합니까? 이것이 nodemon에 대한 정상적인 동작입니까? 그렇지 않은 경우 어떻게 해결할 수 있습니까?
부가 정보 ...
1) 파일은 그 안에 app.js있는 Javascript파일입니다 console.log(111).
2) node버전은 v0.10.25
3) npm버전은 1.3.10
4) nodemon버전은 1.8.1
5) ubuntu버전입니다 ...
Distributor ID: Ubuntu
Description: Ubuntu 14.04.3 LTS
Release: 14.04
Codename: trusty
내 최대 포트가 올바르게 구성되지 않은 것 같습니다. 나는 다음 코드를 실행했고 효과가 있었다 ...
echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
이 명령은 단일 사용자에게 허용되는 시계 수를 늘리는 것입니다. 기본적으로 숫자는 낮을 수 있습니다 (예 : 8192). nodemon많은 수의 디렉토리를보고 변경을 시도 하면 여러 개의 감시를 작성해야하는데이 한계를 초과 할 수 있습니다.
다음을 통해이 문제를 해결할 수도 있습니다.
sudo sysctl fs.inotify.max_user_watches=582222 && sudo sysctl -p
그러나 처음 작성된 방식은이 변경을 영구적으로 만듭니다.
에릭, 당신은 다른 노드 프로세스를 모두 죽일 수 있습니다.
pkill -f 노드
서버를 다시 시작하십시오. 그때 잘 작동합니다.
여기의 논의에 따라 , ENOSPC의미 Error No more hard-disk space available합니다. nodemon또는 gulp-nodemon(필자의 경우) 필요한 메모리가 많은 이유 는 폴더의 내용을보고 있지 않기 때문입니다. 해당 nodemon을 수정하려면 nodemon ignore에게 감시하지 않는 것을 알려주는 데 사용할 수있는 설정이 있습니다. 여기서 nodemon sample config를 살펴보십시오 .
[nodemon] Internal watch failed: watch /home/Document/nmmExpressServer/bin ENOSPC
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nmmexpressserver@0.0.0 start: `nodemon ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nmmexpressserver@0.0.0 start script.
이것은 내가 실행할 때 얻은 오류 nodemon ./bin/www입니다.
솔루션은 프로젝트 창에서 전체 폴더 디렉토리가 열린 Atom 창 을 닫고 있었습니다.
이유를 모르겠지만 Atom과 nodemon이 비슷한 프로세스를 사용하여 파일 / 폴더를 감시한다고 가정합니다.
실행중인 노드 서버에 다음 오류 및 솔루션이 표시됩니다.
nodemon server.js
[nodemon] 1.17.2
[nodemon] 언제든지 다시 시작하려면 다음을 입력하십시오.
rs[nodemon] watching: .
[nodemon] starting
node server.js
[nodemon] Internal watch failed: watch /home/aurum304/jin ENOSPC
sudo pkill -f node
or
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
Add a nodemon.json configuration file in your root folder and specify ignore patterns for example:
nodemon.json
{
"ignore": [
"*.test.js",
"dist/*"
]
}
- Note that by default
.git,node_modules,bower_components,.nyc_output,coverageand.sass-cacheare ignored so you don't need to add them to your configuration.
Explanation: This error happens because you exceeded the max number of watchers allowed by your system (i.e. nodemon has no more disk space to watch all the files - which probably means you are watching not important files). So you ignore non-important files that you don't care about changes in them for example the build output or the test cases.
Instead of specifying a list of directories to ignore (e.g. negative), you can also specify a list of directories to watch (e.g positive):
nodemon --watch dir1 --watch dir2 dir1/examples/index.js
In my particular case, I had one directory I wanted to watch and about nine I wanted to ignore, so specifying '--watch' was much simpler than specifying '--ignore'
in my case closing the visual studio code then starting the server did the trick
Operating system - ubuntu 16.4 lts
node.js version - 8.11.1
npm version - 6.0.0
I had the same error, but in Ubuntu 14.04 inside Windows 10 (Bash on Ubuntu on Windows). All I did to overcome the error was to update the Creators update, which then allowed me to install 16.04 version of Ubuntu bash and then after installing newest version of node (by this steps) I installed also the newest version of npm and then the nodemon started to work properly.
'IT박스' 카테고리의 다른 글
| Javascript-파일 입력 컨트롤에서 파일 이름을 추출하는 방법 (0) | 2020.08.06 |
|---|---|
| URL에 http : //가 없으면 어떻게 추가합니까? (0) | 2020.08.06 |
| Android 목록 환경 설정 : 선택된 값으로 요약이 있습니까? (0) | 2020.08.06 |
| git에서 풀 버전 트리보기 (0) | 2020.08.06 |
| pecl 확장을 설치하려고 할 때 mac OS x 10.7.3의 $ PHP_AUTOCONF 오류 (0) | 2020.08.06 |