Javascript 如何清除 Yarn 中的缓存?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39991508/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to clear cache in Yarn?
提问by nikjohn
I am doing some benchmark tests for Facebook's Yarn. For this, I need to clear my global Yarn cache.
我正在为 Facebook 的 Yarn 做一些基准测试。为此,我需要清除我的全局 Yarn 缓存。
Is there a command available for this? I have force-removed my ~/.yarn-cache
folder, but this seems to be quite manual.
是否有可用的命令?我已经强制删除了我的~/.yarn-cache
文件夹,但这似乎是相当手动的。
回答by nikjohn
Ok I found out the answer myself. Much like npm cache clean
, Yarn also has its own
好的,我自己找到了答案。很像npm cache clean
,Yarn 也有自己的
yarn cache clean
回答by MienDev
Run yarn cache clean
.
运行yarn cache clean
。
Run yarn help cache
in your bash, and you will see:
yarn help cache
在你的 bash 中运行,你会看到:
Usage: yarn cache [ls|clean] [flags]
Options: -h, --help output usage information -V, --version output the version number --offline
--prefer-offline
--strict-semver
--json
--global-folder [path]
--modules-folder [path] rather than installing modules into the node_modules folder relative to the cwd, output them here
--packages-root [path] rather than storing modules into a global packages root, store them here
--mutex [type][:specifier] use a mutex to ensure only one yarn instance is executingVisit http://yarnpkg.com/en/docs/cli/cachefor documentation about this command.
用法:纱线缓存 [ls|clean] [flags]
选项: -h, --help 输出使用信息 -V, --version 输出版本号 --offline
--prefer-offline
--strict-semver
--json
--global-folder [path]
--modules-folder [path] 而不是将模块安装到相对于 cwd 的 node_modules 文件夹中,将它们输出到这里
--packages-root [path] 而不是将模块存储到全局包根目录中,将它们存储在这里
--mutex [type][:specifier]使用互斥锁确保只有一个纱线实例正在执行有关此命令的文档,请访问http://yarnpkg.com/en/docs/cli/cache。
回答by KhaledMohamedP
Also note that the cached directory is located in ~/.yarn-cache/
:
另请注意,缓存目录位于~/.yarn-cache/
:
yarn cache clean
: cleans that directory
yarn cache clean
: 清理那个目录
yarn cache list
: shows the list of cached dependencies
yarn cache list
: 显示缓存的依赖列表
yarn cache dir
: prints out the path of your cached directory
yarn cache dir
: 打印出缓存目录的路径
回答by Dan K.K.
In addition to the answer, $ yarn cache clean
removes all libraries from cache. If you want to remove a specific lib's cache run $ yarn cache dir
to get the right yarn cache directory path for your OS, then $ cd
to that directory and remove the folder with the name
+ version
of the lib you want to cleanup.
除了答案之外,$ yarn cache clean
从缓存中删除所有库。如果您想删除特定库的缓存运行$ yarn cache dir
以获得适用于您的操作系统的正确纱线缓存目录路径,请$ cd
转到该目录并删除带有您想要清理的库的name
+的文件夹version
。