Automatic clean space?


#1

Could someone help me create a code that will allow me to automatically free up space?

I have problem with that and cleaning up space helps but i must do this manually:

events.js:167

  throw er; // Unhandled 'error' event

  ^

Error: listen EADDRINUSE :::3000

at Server.setupListenHandle [as _listen2] (net.js:1328:14)

at listenInCluster (net.js:1376:12)

at Server.listen (net.js:1463:7)

at Function.listen (/rbd/pnpm-volume/94422947-cf90-4b5c-8c58-9d7bab513dad/node_modules/.registry.npmjs.org/express/4.16.3/node_modules/express/lib/application.js:618:24)

at Object. (/app/bot.js:8:5)

at Module._compile (internal/modules/cjs/loader.js:702:30)

at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)

at Module.load (internal/modules/cjs/loader.js:612:32)

at tryModuleLoad (internal/modules/cjs/loader.js:551:12)

at Function.Module._load (internal/modules/cjs/loader.js:543:3)

Emitted ‘error’ event at:

at emitErrorNT (net.js:1355:8)

at process._tickCallback (internal/process/next_tick.js:63:19)

at Function.Module.runMain (internal/modules/cjs/loader.js:746:11)

at startup (internal/bootstrap/node.js:240:19)

at bootstrapNodeJSCore (internal/bootstrap/node.js:564:3)

#2

As a first step, I’d suggest trying to stop your project from filling up in the first place. Make sure to add any frequently changing data files to a .gitignore file.


#3

How to do this? Can you help?


#4

Sure, create a new file called .gitignore in the editor, and then list the names of the files you don’t want to get included in .git, such as any frequently changing data files like .json files and database files. You can see an example here: https://glitch.com/edit/#!/node-beginner?path=.gitignore:1:100

In the example .gitignore:

public/wetty/*
public/*
wetty.js

It’s telling it to ignore all files in the public/wetty directory, all files in the public directory and a file called wetty.js too.


#5

@Gareth I sent you invite to my project. If you could help that would be awesome :slight_smile:


#6

Your project doesn’t seem to create much data. I could only find it creating a warnings.json file. You have a quick.db module in your package.json file though, where is that database?

Any files added to .gitignore are also hidden from the editor (after refreshing), so you don’t want to list commonly edited files, like bot.js.


#7

quick.db is not used in my project


#8

Then I recommend removing it as a dependency from your package.json file, along with any other unused dependencies.


#9

That’s it all? Now I will not get any error about full space?


#10

I said this was a first step - it can still run out of space. We take regular snapshots of your project as you edit it, so you can roll back changes should you need to. But by adding frequently changing data files to .gitignore it should happen less often.


#11

@Gareth Can you look on my project?
Project name: senubot

ERROR  ENOSPC: no space left on device, write

fs.js:119

    throw err;

    ^


    Error: ENOSPC: no space left on device, write

        at Object.writeSync (fs.js:573:3)

        at Object.writeFileSync (fs.js:1180:26)

        at process.on (/home/nvm/pnpm/lib/node_modules/pnpm/lib/node_modules/pnpm-file-reporter/lib/index.js:25:12)

        at process.emit (events.js:187:15)

        at processEmit [as emit] (/home/nvm/pnpm/lib/node_modules/pnpm/lib/node_modules/signal-exit/index.js:149:35)

        at process.exit (internal/process.js:156:15)

        at Timeout.setTimeout [as _onTimeout] (/home/nvm/pnpm/lib/node_modules/pnpm/lib/err.js:10:30)

        at ontimeout (timers.js:427:11)

        at tryOnTimeout (timers.js:289:5)

        at listOnTimeout (timers.js:252:5)