Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

node.js

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 crashed and show error:

Error: ENOSPC.

The server code doesn't run.

$ df -h Filesystem      Size  Used Avail Use% Mounted on /dev/xvda1      7.9G  4.1G  3.5G  55% / udev            288M  8.0K  288M   1% /dev tmpfs           119M  168K  118M   1% /run none            5.0M     0  5.0M   0% /run/lock none            296M     0  296M   0% /run/shm /dev/xvdf       9.9G  3.0G  6.5G  32% /vol overflow        1.0M  1.0M     0 100% /tmp 
like image 326
Giffo Avatar asked Mar 18 '14 09:03

Giffo


Video Answer


2 Answers

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

like image 154
Murali Krishna Avatar answered Sep 17 '22 18:09

Murali Krishna


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.

like image 24
Blu Avatar answered Sep 17 '22 18:09

Blu