Skip to content

[Bug?]: enableGlobalCache default is not true #5682

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

Closed
1 task
ArloL opened this issue Aug 22, 2023 · 7 comments
Closed
1 task

[Bug?]: enableGlobalCache default is not true #5682

ArloL opened this issue Aug 22, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@ArloL
Copy link

ArloL commented Aug 22, 2023

Self-service

  • I'd be willing to implement a fix

Describe the bug

Thanks for all you efforts on making yarn a great piece of software :)

I believe I have found a mistake in the documentation or maybe a bug:

https://yarnpkg.com/configuration/yarnrc#enableGlobalCache says that the default is true.

I just installed yarn for the first time following these instructions and for me it is set to false.

$ yarn config get enableGlobalCache
false
$ grep enableGlobalCache ~/.yarnrc.yml
# returns no results
$ grep enableGlobalCache .yarnrc.yml
# returns no results
$ yarn config --why
…
➤ YN0000: enableGlobalCache             <default>                                             false
…

Am I missing something?

To reproduce

Sadly https://yarnpkg.com/advanced/sherlock returns a Page Not Found error. I found https://website--yarn2.netlify.app/advanced/sherlock but the playground does not work for me: Internal Server Error. But it works with any yarn berry setup.

Environment

System:
  OS: macOS 13.5.1
  CPU: (10) arm64 Apple M1 Pro
Binaries:
  Node: 20.5.1 - /private/var/folders/8z/ppyfj7sd3_52p715brzb6pdm0000gn/T/xfs-2036de14/node
  Yarn: 3.6.2 - /private/var/folders/8z/ppyfj7sd3_52p715brzb6pdm0000gn/T/xfs-2036de14/yarn
  npm: 9.8.0 - /opt/homebrew/bin/npm
npmPackages:
  jest: ^29.2.2 => 29.6.3

Additional context

No response

@ArloL ArloL added the bug Something isn't working label Aug 22, 2023
@ArloL
Copy link
Author

ArloL commented Aug 22, 2023

The documentation I found is for v4. Which it only says on the homepage. Is there any way to add that info to all pages?

@trivikr
Copy link
Contributor

trivikr commented Oct 25, 2023

Yarn 4.0.0 is stable, and enableGlobalCache is now true by default.

$ yarn --version
4.0.0

$ yarn config enableGlobalCache
└─ enableGlobalCache
   ├─ Description: If true, the system-wide cache folder will be used regardless of `cache-folder`
   ├─ Source: <default>
   └─ Value: true

It's reflected in the documentation too at https://yarnpkg.com/configuration/yarnrc#enableGlobalCache

This issue can be closed.

@arcanis arcanis closed this as completed Oct 25, 2023
@dennisameling
Copy link

dennisameling commented Nov 2, 2023

Any chance this could be added to the changelog for v4? Our CI pipeline was configured as YARN_CACHE_FOLDER=./.yarn/cache yarn install --immutable, but after upgrading to v4, that cache folder is no longer being used because enableGlobalCache now defaults to true. This took a bit of work to figure out, and it'd be great if we can prevent folks who are upgrading from running into the same issue 😊 thanks!

We're now using YARN_ENABLE_GLOBAL_CACHE=false YARN_CACHE_FOLDER=./.yarn/cache yarn install --immutable in CI instead.

@merceyz
Copy link
Member

merceyz commented Nov 2, 2023

Any chance this could be added to the changelog for v4?

Feel free to make a PR adding it to https://github.com/yarnpkg/berry/blob/0ee621357efda7a6ce292f35a3755537f191de5f/CHANGELOG.md.

@odinho
Copy link

odinho commented Dec 5, 2023

Interestingly our upgrade from 3 to 4 did not do this, it explicitly set enableGlobalCache: false in the settings file:

diff --git .yarnrc.yml .yarnrc.yml
index 6daead46b6..4b8bff8940 100644
--- .yarnrc.yml
+++ .yarnrc.yml
@@ -1,9 +1,7 @@
+compressionLevel: mixed
+
+enableGlobalCache: false
+
 nodeLinker: node-modules
 
-plugins:
-  - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
-    spec: '@yarnpkg/plugin-workspace-tools'
-  - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
-    spec: '@yarnpkg/plugin-interactive-tools'
-
-yarnPath: .yarn/releases/yarn-3.6.4.cjs
+yarnPath: .yarn/releases/yarn-4.0.2.cjs

@Noyabronok
Copy link

Interestingly our upgrade from 3 to 4 did not do this, it explicitly set enableGlobalCache: false in the settings file:

+compressionLevel: mixed
+enableGlobalCache: false

Same here for 3.2.3 -> 4.1.1 upgrade, including compressionLevel: mixed. Is this the desired behavior?

@clemyan
Copy link
Member

clemyan commented Apr 3, 2024

@Noyabronok

Yes. See #5895 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants