Nodemon: [nodemon] λ‚΄λΆ€ κ°μ‹œ μ‹€νŒ¨: EMFILE κ°μ‹œ

에 λ§Œλ“  2015λ…„ 11μ›” 18일  Β·  24μ½”λ©˜νŠΈ  Β·  좜처: remy/nodemon

λ©°μΉ  전에 λ™μΌν•œ μž‘μ—…μ΄ μ œλŒ€λ‘œ μž‘λ™ν–ˆκΈ° λ•Œλ¬Έμ— 이것이 무엇을 μ΄‰λ°œν–ˆλŠ”μ§€ ν™•μ‹€ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ‚˜λŠ” μ•„λ¬΄λŸ° νš¨κ³Όκ°€ 없도둝 μž¬λΆ€νŒ… ν–ˆμœΌλ―€λ‘œ μ•„λ§ˆλ„ λ„ˆλ¬΄ λ§Žμ€ 파일 μ—΄κΈ° λ¬Έμ œκ°€ 아닐 κ²ƒμž…λ‹ˆλ‹€.

$ nodemon --debug --dump server.js
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
--------------
node: v0.10.26
nodemon: 1.8.1
command: node /Users/rcoupe/.nvm/v0.10.26/bin/nodemon --debug --dump server.js
cwd: /Users/rcoupe/Code/overlay-management-system
OS: darwin x64
--------------
{ run: false,
  system: { cwd: '/Users/rcoupe/Code/overlay-management-system' },
  required: false,
  dirs: [ '/Users/rcoupe/Code/overlay-management-system' ],
  timeout: 1000,
  options:
   { dump: true,
     ignore:
      [ '.git',
        'node_modules',
        'bower_components',
        '.sass-cache',
        re: /\.git|node_modules|bower_components|\.sass\-cache/ ],
     watch: [ '*.*', re: /.*\..*/ ],
     ignoreRoot: [ '.git', 'node_modules', 'bower_components', '.sass-cache' ],
     restartable: 'rs',
     colours: true,
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     runOnChangeOnly: false,
     verbose: false,
     stdout: true,
     execOptions:
      { script: 'server.js',
        exec: 'node',
        args: [ '--debug' ],
        scriptPosition: 1,
        nodeArgs: undefined,
        ext: 'js,json',
        env: {},
        execArgs: [] },
     monitor:
      [ '*.*',
        '!/Users/rcoupe/Code/overlay-management-system/.git/**/*',
        '!/Users/rcoupe/Code/overlay-management-system/node_modules/**/*',
        '!bower_components',
        '!.sass-cache' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  command:
   { raw: { executable: 'node', args: [ '--debug', 'server.js' ] },
     string: 'node --debug server.js' } }
--------------
stale

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

--watch "./directory"λ₯Ό μ‚¬μš©ν•΄ λ³΄μ‹­μ‹œμ˜€. λ‚˜λ₯Ό μœ„ν•΄ 그것은 νš¨κ³Όκ°€ μžˆμ—ˆλ‹€

λͺ¨λ“  24 λŒ“κΈ€

+1

λ‚˜λŠ” 이와 λ™μΌν•œ λ¬Έμ œκ°€ μžˆμ—ˆκ³  NPM 및 Node.js 버전을 μ—…λ°μ΄νŠΈν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€.

λ‚˜λŠ”μ΄ λ¬Έμ œκ°€ μ•„λ¬΄λ°λ„μ—†λŠ” κ²ƒμ²˜λŸΌ λ³΄μž…λ‹ˆλ‹€ ..... 컴퓨터λ₯Ό λ‹€μ‹œ μ‹œμž‘ν–ˆμ§€λ§Œ μ—¬μ „νžˆ μž‘λ™ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€.

**μ΅œμ‹  npm으둜 μ—…κ·Έλ ˆμ΄λ“œν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€.

NPM을 μ—…λ°μ΄νŠΈν•΄λ„ λ¬Έμ œκ°€ ν•΄κ²°λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. Nodemon은 λ‹€λ₯Έ ν”„λ‘œμ νŠΈμ—μ„œ 잘 μž‘λ™ν•©λ‹ˆλ‹€.

$ npm install -g npm
npm http GET https://registry.npmjs.org/npm
npm http 200 https://registry.npmjs.org/npm
npm http GET https://registry.npmjs.org/npm/-/npm-3.5.0.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-3.5.0.tgz
~/.nvm/v0.10.26/bin/npm -> ~/.nvm/v0.10.26/lib/node_modules/npm/bin/npm-cli.js
[email protected] ~/.nvm/v0.10.26/lib/node_modules/npm

$ nodemon server.js
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
[nodemon] Internal watch failed: watch EMFILE

$ npm -v
3.5.0

λ‚˜λ„μ΄ λ¬Έμ œκ°€ μžˆμ—ˆλ‹€. 이것이 λ‹€λ₯Έ μ‚¬λžŒμ—κ²Œ 도움이 될지 μ—¬λΆ€λŠ” μ•Œ 수 μ—†μ§€λ§Œ /usr/local/bin λ””λ ‰ν† λ¦¬λ‘œ μ΄λ™ν•˜μ—¬ rm -rf nodemon을 μ œκ±°ν–ˆμŠ΅λ‹ˆλ‹€. λ‚˜λŠ” μ‹œλ„ν–ˆλ‹€ npm uninstall nodemon ν•˜μ§€λ§Œ λ‚˜μ—κ²Œ λ§ν•˜λŠ” λ©”μ‹œμ§€λ₯Ό λ°˜ν™˜ν–ˆλ‹€ npm WARN uninstall not installed in... λ‚˜λ₯Ό λ¨Όμ € μ–΄λ–»κ²Œ λ“  잘λͺ» λ˜λŠ” λ‚΄κ°€ 이전에 잘λͺ»μ„ μ„€μΉ˜ 것인지과 κ°ˆλ“±μ˜ 일쒅이 μžˆμ—ˆλ‹€ μ„€μΉ˜λ₯Ό μ—¬λΆ€λ₯Ό κΆκΈˆν•˜κ²Œν•˜λŠ” ?

κ°„λ‹¨νžˆ λ§ν•΄μ„œ 이전 nodemon을 μ œκ±°ν•˜κ³  npm install -g nodemon λ‹€μ‹œ μ‹€ν–‰ν–ˆλŠ”λ° λͺ¨λ“  λ¬Έμ œκ°€ ν•΄κ²°λœ 것 κ°™μŠ΅λ‹ˆλ‹€.

λΉ„μŠ·ν•œ λ¬Έμ œκ°€ λ°œμƒν•©λ‹ˆλ‹€. λ…Έλ“œ 5.1.0 및 NPM 3.3.12 μ‚¬μš©.

root<strong i="6">@014b87ca92f1</strong>:/var/www/html# nodemon app.js
[nodemon] 1.8.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
...
info: Server lifted in `/var/www/html`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.

debug: --------------------------------------------------------
debug: :: Mon Dec 07 2015 16:54:53 GMT+0000 (UTC)

debug: Environment : development
debug: Port        : 1337
debug: --------------------------------------------------------
[nodemon] Internal watch failed: watch /var/www/html/node_modules/sails/node_modules/skipper/node_modules/multiparty/.travis.yml ENOSPC

항상 같은 νŒŒμΌμ€ μ•„λ‹™λ‹ˆλ‹€. 맀번 λ¬΄μž‘μœ„λ‘œ λ‹€λ₯Έ νŒŒμΌμ΄μ§€λ§Œ μ•½ 10초 후에 항상 _[nodedemon] Internal watch failed_ λ©”μ‹œμ§€κ°€ ν‘œμ‹œλ˜κ³  nodemon이 μΆ©λŒν•©λ‹ˆκΉŒ?

Docker μ»¨ν…Œμ΄λ„ˆμ—μ„œ 이것을 μ‹€ν–‰ν•˜κ³  μžˆμŠ΅λ‹ˆλ‹€. Node, NPM, Nodemon은 λͺ¨λ‘ μ „μ—­μ μœΌλ‘œ μ„€μΉ˜λ©λ‹ˆλ‹€.
NPM을 3.5.1둜 μ—…κ·Έλ ˆμ΄λ“œν•˜λ €κ³  μ‹œλ„ν–ˆμ§€λ§Œ λ¬Έμ œκ°€ ν•΄κ²°λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€. ~10초 후에도 μ—¬μ „νžˆ 좩돌이 λ°œμƒν•©λ‹ˆκΉŒ?

--watch "./directory"λ₯Ό μ‚¬μš©ν•΄ λ³΄μ‹­μ‹œμ˜€. λ‚˜λ₯Ό μœ„ν•΄ 그것은 νš¨κ³Όκ°€ μžˆμ—ˆλ‹€

μœ„μ˜ κ΄€λ ¨ 문제(re: ENOSPC)λŠ” λ‹€μŒμ„ μˆ˜ν–‰ ν•˜μ—¬ ν•΄κ²°λ˜μ—ˆμŠ΅λ‹ˆλ‹€. μœ λ‹‰μŠ€ 파일 μ‹œμŠ€ν…œκ³Ό ν•œ λ²ˆμ— λ³Ό 수 μžˆλŠ” 파일 μˆ˜μ— λΆ„λͺ…νžˆ κ³ μœ ν•œ 것이 μžˆμŠ΅λ‹ˆκΉŒ?

λ‚˜λŠ” 화면을 톡해 nodemon을 μ‹€ν–‰ν•˜κ³  이것이 λ‚˜μ—κ²Œ 일어났을 λ•Œ ν™”λ©΄ μ„Έμ…˜μ„ μ’…λ£Œν•˜κ³  μƒˆ μ„Έμ…˜μ„ μ‹œμž‘ν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€.

λ³€κ²½λœ max_user_watchs--------->echo fs.inotify.max_user_watches=582222 | sudo ν‹° -a /etc/sysctl.conf && sudo sysctl -p

μƒˆλ‘œμš΄ Linux용 Windows ν•˜μœ„ μ‹œμŠ€ν…œμ—μ„œ 이 λ¬Έμ œκ°€ μΌκ΄€λ˜κ²Œ λ‚˜νƒ€λ‚©λ‹ˆλ‹€.

이것은 supervisor , btwμ—μ„œλŠ” λ¬Έμ œκ°€ λ˜μ§€ μ•ŠλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

@djensen47 μ‹€μ œλ‘œ Windows Ubuntu μ…Έμ˜ 였λ₯˜(적어도 μ €μ—κ²ŒλŠ”)λŠ” EPERM이며 μ—¬κΈ°μ—μ„œ μ„€λͺ…ν•˜λŠ” EMFILE이 μ•„λ‹™λ‹ˆλ‹€.

Windows 10 Bashμ—μ„œ λ°œμƒν•˜λŠ” EPERM λ¬Έμ œμ— λŒ€ν•œ μˆ˜μ • 사항을 찾은 μ‚¬λžŒμ΄ μžˆμŠ΅λ‹ˆκΉŒ?

@Carpetfizz , 방금 Windows 10 Bash와 λ™μΌν•œ λ¬Έμ œκ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€. λ…Έλ“œλͺ¬ 1.10.0, λ…Έλ“œ 6.4.0.
ν•˜λ‚˜μ˜ 파일만 보고 μžˆμ–΄λ„ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€(ex: nodemon -w app.js).

@Carpetfizz λ‚˜λ₯Ό μœ„ν•΄ ν˜„μž¬ κ²½λ‘œμ— λ‚΄κ°€ 싀행쀑인 μŠ€ν¬λ¦½νŠΈκ°€ ν¬ν•¨λ˜μ–΄ μžˆμ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

$ cd /
$ nodemon /tmp/myproject/bin/myproject.js

κΈ°λ³Έ μŠ€ν¬λ¦½νŠΈκ°€ ν¬ν•¨λœ 폴더에 cd둜 μˆ˜μ •ν–ˆμŠ΅λ‹ˆλ‹€.

μ°Έκ³ : μ €λŠ” μš°λΆ„νˆ¬λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.

killall -9 λ…Έλ“œκ°€ 이 문제λ₯Ό ν•΄κ²°ν•©λ‹ˆλ‹€.

λ‹΅λ³€ κ°μ‚¬ν•©λ‹ˆλ‹€! μ§€κΈˆμ€ macOSλ₯Ό μ‚¬μš©ν•˜μ§€λ§Œ W10Bashλ₯Ό λ‹€μ‹œ μ‚¬μš©ν•΄μ•Ό ν•˜λŠ” 경우 μ†”λ£¨μ…˜μ„ ν™•μΈν•˜κ² μŠ΅λ‹ˆλ‹€.

ps -ef | ν”„λ‘œμ„ΈμŠ€ IDλ₯Ό μ°ΎκΈ° μœ„ν•œ grep λ…Έλ“œ

그런 λ‹€μŒ sudo kill -9

이 λ¬Έμ œλŠ” 졜근 ν™œλ™μ΄ μ—†μ—ˆκΈ° λ•Œλ¬Έμ— 유휴 μƒνƒœλ‘œ μžλ™ ν‘œμ‹œλ˜μ—ˆμŠ΅λ‹ˆλ‹€. 더 이상 ν™œλ™μ΄ λ°œμƒν•˜μ§€ μ•ŠμœΌλ©΄ μžλ™μœΌλ‘œ λ‹«νž™λ‹ˆλ‹€. 이것이 잘λͺ»λ˜μ—ˆλ‹€κ³  μƒκ°ν•˜κ±°λ‚˜ λ¬Έμ œκ°€ μ—¬μ „νžˆ μ§€μ†λ˜λŠ” 경우 λŒ“κΈ€μ— λ‹΅μž₯을 μž…λ ₯ν•˜λ©΄ @remy κ°€ (μ‹œλ„!) 후속 쑰치λ₯Ό
κΈ°μ—¬ν•΄μ£Όμ…”μ„œ κ°μ‚¬ν•©λ‹ˆλ‹€ <3

이 λͺ…령을 μ‹€ν–‰

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

λ‚˜λŠ” 였λ₯˜λ₯Ό μ–»μ—ˆλ‹€

sysctl: illegal option -- p
usage: sysctl [-bdehiNnoqx] name[=value] ...
       sysctl [-bdehNnoqx] -a

λ‚΄κ°€ μ‚­μ œν•˜μ—¬ λ‚΄ Macμ—μ„œ 그것을 ν•΄κ²° node_modules ν•˜κ³  λ‹€μ‹œ μ„€μΉ˜ nodemon κ°€ globally_ μ‚¬μš© _not 톡해 λ‹€μ‹œ; κ·Έ ν›„ μ •μƒμ μœΌλ‘œ μž‘λ™ν–ˆμŠ΅λ‹ˆλ‹€.

심지어 같은 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€.

[nodemon] λ‚΄λΆ€ κ°μ‹œ μ‹€νŒ¨: EMFILE: μ—΄λ € μžˆλŠ” 파일이 λ„ˆλ¬΄ λ§ŽμŠ΅λ‹ˆλ‹€. κ°μ‹œ

nodemon을 μ œκ±°ν•˜κ³  λ‹€μ‹œ μ„€μΉ˜ν•˜μ—¬ 문제λ₯Ό ν•΄κ²°ν–ˆμŠ΅λ‹ˆλ‹€.

npm uninstall -g nodemon; npm install -g nodemon

이것이 λ‹Ήμ‹ μ—κ²Œλ„ νš¨κ³Όκ°€ 있기λ₯Ό λ°”λžλ‹ˆλ‹€ πŸ‘

--ignore node_modules μ‹œλ„ν•  수 μžˆμŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰