Yarn: Allow for ENVVAR specification of YARN cache directory location

Created on 18 Oct 2016  路  11Comments  路  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Feature request

What is the current behavior?
The cache location is mapped relative to the user home directory across OSs.

If the current behavior is a bug, please provide the steps to reproduce.
NA

What is the expected behavior?
To be able to specify by an environment variable or cli setting a yarn config path. For many docker users, this would allow a mounted location to be used for the cache, or to specify a network path for a shared cache in automated build systems, etc.

Please mention your node.js, yarn and operating system version.
Ubuntu 16.04 (docker), node version 6.1.0, yarn version 0.16.0.

cat-feature help wanted

Most helpful comment

The original title of this issue was "Allow for ENVVAR specification of YARN cache directory location" (though the expected behavior mentions also a cli setting), and as it was closed by https://github.com/yarnpkg/yarn/pull/2046, i was hoping that there were a kind of hidden magic allowing to define setting by environment variable mapping, just like npm does (see: https://docs.npmjs.com/misc/config#environment-variables).

It does not appear to be the case :) (or not ?)

I'm curious, @ryanmt how do you handle this with docker ?
For my part, I am used to define COMPOSER_CACHE_DIR and NPM_CONFIG_CACHE environment variable pointing to a shared volume.

All 11 comments

I'm experiencing the same problem. I wanted to set the cache folder location via yarn config but looking at the Config.init(...) bootstrapping process, it's only possible to set it from the --cache-folder option on the cli at this time.

Thanks for the issue @ryanmt and follow up @mmerickel
This would make for a really great first PR into yarn.

Thanks

This would be really handy for running yarn inside AWS lambda. The user home directory on lambda is read-only which causes a lambda fs permission error to be thrown at https://github.com/yarnpkg/yarn/blob/553e55f146a465a4e773b53b0a93752163c4b039/bin/yarn.js#L10

My usecase is docker; during development, I want docker to read from (and write to) a project-specific cache which I can access by running yarn add within my project on the host machine (my laptop).

@ryanmt no PR? :)

I suppose that yarn 0.18.0 released with PR #2046 makes this issue fixed, and this could be closed?

This landed in v0.18.0.

I'm sorry, but i don't get it :)
Is there somewhere a way to pass the yarn config dir as an environment variable ?
I don't see such a thing in https://github.com/yarnpkg/yarn/pull/2046

I'm sorry, but i don't get it :)
Is there somewhere a way to pass the yarn config dir as an environment variable ?
I don't see such a thing in #2046

The original PR description had this text in it:

To be able to specify by an environment variable or cli setting a yarn config path

So I'd say this requirement is fulfilled and thus this issue was closed as fixed.

Maybe open a new issue with a thorough use case explaining why you need to be able to use an environment variable and why the config option is not enough for you?

The original title of this issue was "Allow for ENVVAR specification of YARN cache directory location" (though the expected behavior mentions also a cli setting), and as it was closed by https://github.com/yarnpkg/yarn/pull/2046, i was hoping that there were a kind of hidden magic allowing to define setting by environment variable mapping, just like npm does (see: https://docs.npmjs.com/misc/config#environment-variables).

It does not appear to be the case :) (or not ?)

I'm curious, @ryanmt how do you handle this with docker ?
For my part, I am used to define COMPOSER_CACHE_DIR and NPM_CONFIG_CACHE environment variable pointing to a shared volume.

@nervo I have opened #3208 specifically for environment variable support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jshthornton picture jshthornton  路  72Comments

indieisaconcept picture indieisaconcept  路  90Comments

jmorrell picture jmorrell  路  93Comments

sfabriece picture sfabriece  路  73Comments

johnmuhl picture johnmuhl  路  84Comments