Skip to content

[Bug?]: NodeLinker: pnpm, enableGlobalCache: false and enableMirror: false still populates the Global cache #6877

@X-Guardian

Description

@X-Guardian

Self-service

  • I'd be willing to implement a fix

Describe the bug

With nodeLinker: pnpm, enabledGlobalCache: false and enableMirror: false set, on running yarn install, the globalFolder is populated with cached files when I would not expect it to be.

To reproduce

package.json

{
  "name": "yarn-pnpm-test",
  "dependencies": {
    "typescript": "5.7.3"
  },
  "packageManager": "yarn@4.9.2"
}

.yarnrc.yml

nodeLinker: pnpm
enableGlobalCache: false
enableMirror: false
globalFolder: ./.yarn/global-cache

Script

#!/bin/bash

GLOBAL_CACHE_DIR='./.yarn/global-cache'
rm -rf $GLOBAL_CACHE_DIR
rm -rf node_modules
yarn install
# Report the number of files in the global cache
find $GLOBAL_CACHE_DIR -type f | wc -l

This reports 130 files in the global-cache dir

Changing the nodeLinker to pnp or node-modules and re-running the script both report only 1 file in the global-cache dir as expected.

Environment

System:
    OS: macOS 15.3.2
    CPU: (12) arm64 Apple M2 Pro
  Binaries:
    Node: 22.16.0 - /private/var/folders/pz/q84_my554js504tv_6w4g1gh0000gp/T/xfs-7bfe9783/node
    Yarn: 4.9.2 - /private/var/folders/pz/q84_my554js504tv_6w4g1gh0000gp/T/xfs-7bfe9783/yarn
    npm: 10.9.2 - ~/.nvm/versions/node/v22.16.0/bin/npm
    bun: 1.1.42 - /opt/homebrew/bin/bun

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions