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

后端 未结 16 2257
爱一瞬间的悲伤
爱一瞬间的悲伤 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:44

    This sounds very odd, but yes, a system reboot or killall node solves the problem for me.

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

    ENOSPC means that there is no space on the drive.

    Perhaps /tmp is full? You can configure npm to use a different temp folder by setting npm config set tmp /path/to/some/other/dir, or maybe delete everything out of the /tmp folder.

    Source: npm 1.1.21 cannot write, ENOSPC in npm's repo in github.

    Note I solved my problem in the way that described in above source. However, see Murali Krishna's answer, which is more comprehensive.

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

    Run the below command to avoid ENOSPC:

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

    For Arch Linux add this line to /etc/sysctl.d/99-sysctl.conf:

    fs.inotify.max_user_watches=524288
    

    Then execute:

    sysctl --system
    

    This will also persist across reboots. Technical Details Source

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

    I solved my problem killing all tracker-control processes (you could try if you use GDM, obviously not your case if the script is running on a server)

    tracker-control -r
    

    My setup: Arch with GNOME 3

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