sindresorhus / find-cache-dir

Finds the common standard cache directory
MIT License
151 stars 24 forks source link

Return `null` if the found `node_modules` directory is not writable #10

Closed globin closed 4 years ago

globin commented 6 years ago

When building node modules with Nix/node2nix node_modules is pre-built and mounted read-only, resulting in node_modules/.cache not being writable. A nice and easy possibility to change the directory would be to allow overriding it with an ENV var (NODE_CACHE_DIR?)

indeyets commented 5 years ago

The minimal solution of this issue is to return null if directory is not writable. It will trigger fallback in most of packages which use this.

adding support for some kind of env is still a good idea to make installations more controllable.

@sindresorhus will you accept pull-request for minimal solution proposed above?

sindresorhus commented 5 years ago

I don't think we want an environment variable, but checking whether the directory is writeable is a good idea. PR welcome for that.

Richienb commented 5 years ago

I'll get this sorted when #18 is resolved to prevent conflicts.