-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce an option to not use any cache #986
Comments
You can actually change your global and cache folders folder, but there seems to be some linking errors at the moment.
|
@olingern do you think it will prevent the double actions of downloading and then copying to node_modules? I feel like yarn is not able to realise this specific situation… |
I am also very interested in such a feature, with the same requirements and use case as in #1178. In a Docker image, the cache will never be used again, so it should be possible to just skip it altogether to improve the final disk size. |
@victornoel it looks like the cache is stored in a different format so I don't think setting the cache to |
@deployable I don't think the solution is via a hack, this should be handled by yarn itself. |
@victornoel Agreed, I wasn't suggesting otherwise. Just providing the workaround "until this is added to yarn" |
by the way @deployable, I just realised I was misinterpreting your comment: my need is not to remove after a yarn install (what your workaround does), my need is not to use any cache at all and not download dependencies in the cache before copying them to |
@victornoel oic. It actually is possible to access an in memory
There's no simple |
@deployable I don't know why you insist on having me using a cache folder :) I don't want to! Still, these are good workaround for those who are interested by the use case of #1178, so I'm pretty sure @jdno and @andrewmclagan are happy for your share :) |
@victornoel I'm not insisting, it's yarn insisting! :) at least until a PR. |
how about running This is what i do:
|
@andrewmclagan yes, I think this is exactly the same as what other people are proposing (it is equivalent to removing the cache folder), but that's not the subject of the issue. |
I second @victornoel, the ability to just install straight into node_modules without having an intermediate cache has it's use cases. (assuming I understand the issue of @victornoel correctly that is) |
Our cache directories keep growing in size on the server. We would like to simply disable it |
I've created yarnpkg/rfcs#53 for a RFC for this issue. I tried to summarize the discussion here. Please comment on it if there is anything about it that should be changed. |
@dguo thanks, good job! |
Discussion moved to RFC |
I think disable cache will add to package server load~ |
In docker it's an extra command to clean cache to make sure image is lean. |
I need this feature also. kind of a global config to disable yarn cache completely. My case is my development Macbook storage is quite small and yarn cache use around 1 GB of storage and internet bandwidth is free. Thanks |
What command is that? |
@zjye-idealhub yarn cache clean: https://classic.yarnpkg.com/en/docs/cli/cache/ |
|
This feature would really help me for my use case. I'm trying to install a package inside of AWS Lambda, which has a 512 MB disk limit and only allows me to write to |
Haven't tried this, but shouldn't you be able to point the cache to edit Nevermind, doesn't seem to work with folders. |
Right now I'm trying to run a docker image using --read-only, I want to use to restrict permissions on it after creating a multi stage release build. However yarn breaks the build because of not being able to disable the cache with |
In my case, with yarn v1, adding |
I've found that using a cache mount is an effective solution. It prevents the data from being added to the layer and has the added benefit of still allowing the cache to be used between builds. |
Thank you @daveisfera for mentioning cache mounts. For anyone wondering about the exact command, it should be something like: RUN --mount=type=cache,target=/usr/local/share/.cache yarn install Where In my case, this reduced the image size from 1.1Gb to 294Mb! |
@daveisfera HUGE help. Thanks so much! I've been poking around for days trying to solve this issue and your solution reduced my size from 2.47GB to 926MB. (I still want to whittle it down further but this at least gets me past my issues building/scanning the image in a GitHub action.) |
Might be offtopic but also be sure to |
Do you want to request a feature or report a bug?
feature
What is the current behavior?
When calling
yarn
, packages are first downloaded to the global cache before being put innode_modules
What is the expected behavior?
With an option, e.g.,
--no-cache
, callingyarn --no-cache
will skip the use of a global cache and directly work at the node_modules level.Why?
In a CI runner, where only the package used by the project being tested/integrated are of interest, it would make sense to simply populate the node_modules directory instead of the yarn global cache and then copy the dependencies to node_modules.
Coupled with CI caching, one would just need to cache the node_modules directory and call
yarn --no-cache --pure-lockfile
to get the correctnode_modules
in a minimum of time.Currently, the only solution is either to cache the global yarn cache and rebuild
node_modules
on every build, or to cache both but then we cache twice every dependency!Please mention your node.js, yarn and operating system version.
yarn v0.15.1, node v6.7.0 and linux
The text was updated successfully, but these errors were encountered: