Errno::ENOSPC: No space left on device in Ruby on Rails

I had a the same error message when trying to run an npm install.

npm ERR! nospc ENOSPC: no space left on device, open /{dir}/...

The fix for me was the following:

  • sudo rm -rf node_modules - Remove node_modules
  • df -hi - Check the available disk space
  • sudo apt-get update - Update packages
  • sudo apt-get autoremove - Use 'autoremove' to remove packages that are no longer needed
  • sudo apt-get -f install - Correct broken dependencies

It's true, you have very little space left.

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda             9.5G  8.7G  325M  97% /

Only a few hundred megabytes, and your disk will be full again.

You said you expected to have much more disk space than this shows, so I would recommend you contact Linode to find out what's going on.