Node.js: what is ENOSPC error and how to solve?

后端 未结 16 2148
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 08:52

I have a problem with Node.js and uploading files to server. For uploading files to server I use this plugin. When starting file upload to the server, Node.js process crashe

相关标签:
16条回答
  • 2020-11-22 09:29

    If you're using VS Code then it'll should unable to watch in large workspace error.

    "Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)
    

    It indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files. The current limit can be viewed by running:

    cat /proc/sys/fs/inotify/max_user_watches
    

    The limit can be increased to its maximum by editing /etc/sysctl.conf and adding this line to the end of the file:

    fs.inotify.max_user_watches=524288
    

    The new value can then be loaded in by running sudo sysctl -p.

    Note: 524288 is the max value to watch the files. Though you can watch any no of files but is also recommended to watch upto that limit only.

    0 讨论(0)
  • 2020-11-22 09:31

    I was having Same error. While I run Reactjs app. What I do is just remove the node_modules folder and type and install node_modules again. This remove the error.

    0 讨论(0)
  • 2020-11-22 09:34

    On Linux, this is likely to be a limit on the number of file watches.

    The development server uses inotify to implement hot-reloading. The inotify API allows the development server to watch files and be notified when they change.

    The default inotify file watch limit varies from distribution to distribution (8192 on Fedora). The needs of the development server often exceeds this limit.

    The best approach is to try increasing the file watch limit temporarily, then making that a permanent configuration change if you're happy with it. Note, though, that this changes your entire system's configuration, not just node.

    To view your current limit:

    sysctl fs.inotify.max_user_watches
    

    To temporarily set a new limit:

    # this limit will revert after reset
    sudo sysctl fs.inotify.max_user_watches=524288
    sudo sysctl -p
    # now restart the server and see if it works
    

    To set a permanent limit:

    echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p
    
    0 讨论(0)
  • If your /tmp mount on a linux filesystem is mounted as overflow (often sized at 1MB), this is likely due to you not specifying /tmp as its own partition and your root filesystem filled up and /tmp was remounted as a fallback.

    To fix this after you’ve cleared space, just unmount the fallback and it should remount at its original point:

    sudo umount overflow
    
    0 讨论(0)
  • 2020-11-22 09:37

    For me I had reached the maximum numbers of files a user can own

    Check your numbers with quota -s and that the number under files is not too close to the quota

    0 讨论(0)
  • 2020-11-22 09:44

    On Ubuntu 18.04 , I tried a trick that I used to reactivate the file watching by ionic/node, and it works also here. This could be useful for those who don't have access to system conf files.

    CHOKIDAR_USEPOLLING=1 npm start
    
    0 讨论(0)
提交回复
热议问题