Reputation: 4231
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
Upvotes: 410
Views: 366500
Reputation: 1701
I've got the error on Windows 10 using a node.js client application which was writing a 4GB+ file to a FAT32 drive. FAT32 doesn't support a file size larger than 4GB, so it does make sense.
[ERROR] Error: ENOSPC: no space left on device, write
...
errno: -4055,
syscall: 'write',
code: 'ENOSPC'
My solution was to change the output path to another drive (with NTFS file system).
Upvotes: 0
Reputation: 14343
ENOSPC means that there is no space on the drive.
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
Upvotes: 1402
Reputation: 580
My case was different from that of the question in that I was left with no disk space in the system partition (in my case /dev/root
) following a system upgrade with the command: sudo apt update && sudo apt upgrade -y
.
I tried several solutions included above, but nothing helped until I ran the command:
sudo apt-get clean
As stated here:
The apt-get clean command helps to clean out the cache once you have installed the packages using apt-get install command in your system. It removes the files that are no longer required but are still residing on your system and keeping the system space.
Upvotes: 0
Reputation: 2744
In my case, I did this
yarn cache clean
npm cache verify
rm -rf node_modules/
yarn install
Upvotes: 0
Reputation: 1016
Tried most of the things suggested above. At the end deleting node_modules directory helped me.
So I think what worked is:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
sudo sysctl --system
rm -r /tmp*
(!! make sure this will not break anything for you)rm -r node_modules
Restart system
Upvotes: 1
Reputation:
It indicates that the VS Code file watcher is running out of handles because the workspace is large and contains many files. The max limit of watches has been reacherd, you can viewed the limit by running:
cat /proc/sys/fs/inotify/max_user_watches
run below code resolve this issue:
fs.inotify.max_user_watches=524288
Upvotes: 0
Reputation: 4056
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.
Upvotes: 87
Reputation: 7190
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.
Upvotes: 6
Reputation: 9117
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
Upvotes: 9
Reputation: 333
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
Upvotes: 9
Reputation: 138
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.
Upvotes: 2
Reputation: 1366
A simple way that solve my problem was:
npm cache clear
npm or a process controlled by it is watching too many files. Updating max_user_watches on the build node can fix it forever. For debian put the following on terminal:
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
If you want know how Increase the amount of inotify watchers only click on link.
Upvotes: 33
Reputation: 22789
Rebooting the machine solved the problem for me. I first tried wiping /tmp/
but node was still complaining.
Upvotes: 8
Reputation: 18692
If you encounter this error during trying to run ember server
command please rm -rf tmp
directory. Then run ember s
again. It helped me.
Upvotes: 2
Reputation: 990
Can't take credit for this, but @grenade pointed out that npm dedupe
will fix the cause (too many files) and not the symptom.
Source: Grunt watch error - Waiting…Fatal error: watch ENOSPC.
Upvotes: 28
Reputation: 33
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
Upvotes: 2
Reputation: 530
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
Upvotes: 2
Reputation: 4241
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
Upvotes: 1
Reputation: 130
In my case, on linux, sudoing fixed the problem.
Example:
sudo gulp dev
Upvotes: -19