danielgtaylor / danielgtaylor/aglio

Cannot write or read cache for themes (ENOENT on cache folder)

Open
#257 4 comments 14 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
4.7k
Forks
471
PR merge metrics
No merged PRs in 30d

Description

I am suddenly experiencing a problem with the `aglio-olio-theme`. I'm receiving a `ENOENT` issue (missing file/directory) on `aglio 2.2.0`:

```
Error: Could not get CSS: Error writing cached CSS to file: ENOENT: no such file or directory, open '/Users/adminaccount/Code/clint/ui/node_modules/blot/node_modules/aglio-theme-olio/cache/b0b0865f713b341beb7fe4b90d8e628262a88e6b.css'"
```

I was able to resolve this error by simply running the following:

```
mkdir node_modules/blot/node_modules/aglio-theme-olio/cache
```

The `postinstall` script for the `aglio-theme-*` packages could be updated to simply ensure the cache directory exists before the module is used. Alternatively you could check that the cache directory exists just before it's used, using something like `mkpath` - I personally prefer the latter approach as it prevents the build from getting too crufty.

I also wanted to note that the `NO_CACHE=1` flag will not resolve the issue here, which is expected since this flag only prevents the _reading_ of the cache, not the **creation** of it. Updating this flag to be responsible for both creating and reading the cache is another potential solution here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Inspect the aglio-theme-* package postinstall script and the cache-writing path that produces the CSS error; begin by reproducing the failure with the cache directory absent and compare it with NO_CACHE=1. Done means a missing cache directory no longer causes ENOENT when themes are read or written, with the chosen behavior reflected in coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
coffeescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.