Node.JS: Getting error : [nodemon] Internal watch failed: watch ENOSPC

后端 未结 12 685
小鲜肉
小鲜肉 2020-12-07 07:49

I just installed Node.js on my Ubuntu 14.04 operating system for the first time. I also installed npm. The next step in my installatio

相关标签:
12条回答
  • 2020-12-07 08:04

    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, coverage and .sass-cache are 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.

    0 讨论(0)
  • 2020-12-07 08:06

    If the operating system is Linux then just use it will work

     sudo npm run server
    
    0 讨论(0)
  • 2020-12-07 08:07

    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.

    0 讨论(0)
  • 2020-12-07 08:17

    On running node server shows Following Errors and solutions:

    nodemon server.js

    [nodemon] 1.17.2

    [nodemon] to restart at any time, enter 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
    
    0 讨论(0)
  • 2020-12-07 08:17

    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

    0 讨论(0)
  • 2020-12-07 08:18

    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'

    0 讨论(0)
提交回复
热议问题