NPM/Yarn Cache Keeps Growing

Hi,

I’ve had my ghost blog running for some time, rolling through a number of upgrades and one reinstallation over the past years.

Version: 3.0.2
Default configuration - no code changes from base.
Browser isn’t relevant for my problem.
No errors.

I’m installed on Linux Mint and my issue is as follows:

The cache folder in my home directory contains a folder for Yarn. Directory structure looks like this (only showing one module “acorn” as example - there are thousands of others in the v4 folder):

/yarn
  /v4
    /npm-acorn-3.3.0-xxx
    /npm-acorn-5.7.3-xxx
    /npm-acorn-6.0.5-xxx
    /npm-acorn-5.7.3-xxx
    /npm-acorn-6.0.5-xxx
    /npm-acorn-6.1.0-xxx
    /npm-acorn-6.1.1-xxx
    /npm-acorn-6.2.1-xxx
    /npm-acorn-6.3.0-xxx
    /npm-acorn-7.0.0-xxx
    /npm-acorn-7.1.0-xxx
  /v6
    /npm-acorn-3.3.0-xxx
    /npm-acorn-5.7.3-xxx
    /npm-acorn-6.3.0-xxx
    /npm-acorn-7.1.0-xxx

The server it runs on is reporting this folder as one of the largest, clocking in at over 2.6GB. This is a rolling cache that never clears automatically.

Ghost is the only application I have which uses NPM.

Housekeeping for this is super easy - head over to https://yarnpkg.com/en/docs/install#debian-stable and follow instructions to install Yarn, then run

yarn cache clean

OR, as I discovered after combing documentation

ghost buster

In a production environment dedicated to Ghost, this is something which I think could perhaps get called after a ghost update is installed, in much the same way as old versions of Ghost itself get automatically cleaned up.

Thoughts?

Kind Regards, Pete

1 Like