Error: ENOSPC: no space left on device

When I run Meteor in test mode, I get an error like the following:

Error: ENOSPC: no space left on device, write

OS: Ubuntu 16.04 LTS

Steps to reproduce:

  1. Create a new barebones Meteor project: meteor create meteorMocha then cd meteorMocha

  2. Run one of the following commands:

    meteor test --once --driver-package meteortesting:mocha
    
    TEST_WATCH=1 meteor test --driver-package meteortesting:mocha
    
    npm run test
    

In each case, I get output similar to the following, with a no space left on device error:

[[[[[ Tests ]]]]]                             

=> Started proxy.                             
/home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

Error: ENOSPC: no space left on device, mkdir '/tmp/meteor-test-run1qr7tav.envkf/.meteor/local/.build245450.build'
    at Object.mkdirSync (fs.js:921:3)
    at /home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1638:23
    at Object.mkdir_p (/home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:446:5)
    at new Builder (/tools/isobuild/builder.js:123:13)
    at /tools/isobuild/bundler.js:2915:35
    at /tools/isobuild/bundler.js:3355:22
    at Object.capture (/tools/utils/buildmessage.js:283:5)
    at bundle (/tools/isobuild/bundler.js:3169:31)
    at /tools/isobuild/bundler.js:3113:32
    at Slot.withValue (/home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/@wry/context/lib/context.js:73:29)
    at Object.withCache (/home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/fs/tools/fs/files.ts:1659:39)
    at Object.bundle (/tools/isobuild/bundler.js:3113:16)
    at /tools/runners/run-app.js:572:24
    at Function.run (/home/username/.meteor/packages/meteor-tool/.1.11.1.i3yk3t.x2u9h++os.linux.x86_64+web.browser+web.browser.legacy+web.cordova/mt-os.linux.x86_64/tools/tool-env/tools/tool-env/profile.ts:289:14)
    at bundleApp (/tools/runners/run-app.js:571:34)
    at AppRunner._runOnce (/tools/runners/run-app.js:617:35)
    at AppRunner._fiber (/tools/runners/run-app.js:931:28)
    at /tools/runners/run-app.js:401:12 {
  errno: -28,
  syscall: 'mkdir',
  code: 'ENOSPC',
  path: '/tmp/meteor-test-run1qr7tav.envkf/.meteor/local/.build245450.build'
}

Evoking the Properties window on /tmp shows that I have 261,6 MB free space there. Here is the output of sudo df:

Filesystem     1K-blocks     Used Available Use% Mounted on
udev             3975032        0   3975032   0% /dev
tmpfs             801120     9824    791296   2% /run
/dev/nvme0n1p5  19554584 18282744    255472  99% /
tmpfs            4005584    83864   3921720   3% /dev/shm
tmpfs               5120        4      5116   1% /run/lock
tmpfs            4005584        0   4005584   0% /sys/fs/cgroup
...
/dev/nvme0n1p7  79974240 63293928  12594808  84% /home
/dev/nvme0n1p1    507904    83888    424016  17% /boot/efi
tmpfs             801120       72    801048   1% /run/user/1000

What can I do to solve or work around this error?

261,6 MB is just not enough. I’ve just checked, my own current Meteor install size is 310 MB.

Thanks @peterfkruger. I guessed as much. But I have over 16 GB free disk space. How can I either (a) tell tmp/ to use more of the free space, or (b) tell Meteor to build in a different directory?

It seems that you have plenty of space left on your file system /dev/nvme0n1p7 – this is where the /home directory is mounted on your system. So if you manage to tell meteor to forget /tmp and use the space that’s in your home directory, the problem will be solved.

Please try out following command: meteor help test

In the output you’ll see various options, among those this one:

  --test-app-path   Set the directory in which to create a temporary app used
                    for tests. Defaults to the system's temporary directory,
                    usually /tmp.

Use it :slight_smile:

This works:

meteor test --once --driver-package meteortesting:mocha --test-app-path '~/myTempFolder'

Thank you!