Skip to content

Problem with yarn v4.14 config approvedGitRepositories #1534

Closed

Description

@dimaslanjaka

Description:
Yarn requires config approvedGitRepositories for fetching packages from repositories. e.g:

approvedGitRepositories:
  ['https://github.com/yarnpkg/*', 'ssh://git@github.com/yarnpkg/*', 'https://github.com/dimaslanjaka/*']

when i put approvedGitRepositories to .yarnrc.yml, actions/setup-node@v6 will throw error

Run actions/setup-node@v6
Found in cache @ /opt/hostedtoolcache/node/20.20.2/x64
Environment details
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
/usr/local/bin/yarn --version
4.14.1
/usr/local/bin/yarn config get cacheFolder
4.14.1
3.5.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
3.4.1
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
4.14.1
4.14.1
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/usr/local/bin/yarn config get cacheFolder
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
Usage Error: Unrecognized or legacy configuration settings found: approvedGitRepositories - run "yarn config -v" to see the list of settings supported in Yarn (in /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarnrc.yml)

$ yarn config get [--json] [--no-redacted] <name>
Usage Error: Unrecognized or legacy configuration settings found: approvedGitRepositories - run "yarn config -v" to see the list of settings supported in Yarn (in /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarnrc.yml)

$ yarn config get [--json] [--no-redacted] <name>
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
Error: The 'yarn config get cacheFolder' command failed with exit code: 1
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache
/home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/.yarn/cache

when i remove approvedGitRepositories, got another error on other step

Run yarn cache clean --all
➤ YN0000: Done in 0s 4ms
Some packages are missing: gulp, glob, sbg-utility, upath, fs-extra
Running yarn install...
➤ YN0000: · Yarn 4.14.1
➤ YN0000: ┌ Resolution step
Resolution step
➤ YN0080: @types/through2@https://github.com/dimaslanjaka/nodejs-package-types/tarball/through2: Request to 'https://github.com/dimaslanjaka/nodejs-package-types.git' has been blocked because it doesn't match any of the patterns in 'approvedGitRepositories'
➤ YN0000: └ Completed in 10s 690ms
➤ YN0000: · Failed with errors in 10s 706ms
node:internal/modules/esm/resolve:873
  throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base), null);
        ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'fs-extra' imported from /home/runner/work/static-blog-generator-hexo/static-blog-generator-hexo/setup.mjs
    at packageResolve (node:internal/modules/esm/resolve:873:9)
    at moduleResolve (node:internal/modules/esm/resolve:946:18)
    at defaultResolve (node:internal/modules/esm/resolve:1188:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:708:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:657:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:640:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:264:38)
    at ModuleLoader.import (node:internal/modules/esm/loader:605:34)
    at defaultImportModuleDynamicallyForModule (node:internal/modules/esm/utils:221:31)
    at importModuleDynamicallyCallback (node:internal/modules/esm/utils:260:12) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Action version:
v6

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

yarn version 4.14.1
System:
    OS: Windows 10 10.0.19045
    CPU: (4) x64 Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
  Binaries:
    Node: 22.17.1 - C:\Users\Dell\AppData\Local\Temp\xfs-b20f392a\node.CMD
    Yarn: 4.14.1 - C:\Users\Dell\AppData\Local\Temp\xfs-b20f392a\yarn.CMD
    npm: 11.11.1 - C:\nvm4w\nodejs\npm.CMD

Repro steps:
https://github.com/dimaslanjaka/static-blog-generator-hexo
https://github.com/dimaslanjaka/static-blog-generator-hexo/blob/3e4631dc501b9dc8e881919d75ed127df65aeabb/.github/workflows/build-site.yml

Linked issues:

Activity

  1. changed the title [-]Problem with yarn config approvedGitRepositories[/-] [+]Problem with yarn v4.14 config approvedGitRepositories[/+] on Apr 20, 2026
  2. v-priya-kinthali commented on Apr 20, 2026

    @v-priya-kinthali
    Contributor

    Hello @dimaslanjaka👋,
    Thank you for reporting this issue. We will investigate it and get back to you as soon as we have some feedback.

  3. v-gowridurgad commented on May 18, 2026

    @v-gowridurgad
    Contributor

    Hi @dimaslanjaka, thanks for sharing the detailed logs.

    We've looked into this and validated the behavior on our end. Based on our investigation, the repository has multiple .yarnrc.yml files with different Yarn versions. When actions/setup-node runs with cache-dependency-path: '**/package.json', it scans all subdirectories and executes yarn config get cacheFolder in each. Due to Yarn's configuration inheritance, the older Yarn versions (3.4.1, 3.5.1) read settings from the root .yarnrc.yml which contains approvedGitRepositories, but this setting was introduced in Yarn 4.14.0 so older versions don't recognize it and throw an error.

    To resolve this, please try one of the following:

    1. Change cache-dependency-path to only scan root by using cache-dependency-path: 'package.json' instead of '**/package.json',
    2. Remove the yarnPath setting from nested .yarnrc.yml files so they inherit the Yarn version from root.
  4. dimaslanjaka commented on May 24, 2026

    @dimaslanjaka
    Author

    @gowridurgad so, for subproject (workspace) for example i remove yarn path from .yarnrc.yml,
    is it still uses yarn berry when sometimes i need isolate the subproject from root (development) ?

  5. v-gowridurgad commented on May 28, 2026

    @v-gowridurgad
    Contributor

    Hi @dimaslanjaka, If yarnPath is removed from a nested .yarnrc.yml, that subproject would fall back to the Yarn version resolved from the parent/root configuration, so in your case it would use the root Yarn version (4.x), which supports approvedGitRepositories.

    If you need to keep the subproject on its own pinned Yarn version, you could either limit cache-dependency-path to package.json so actions/setup-node only checks the root project, or use Yarn versions across the repository that support approvedGitRepositories, so the root and nested configurations remain compatible.

  6. v-gowridurgad commented on Jun 9, 2026

    @v-gowridurgad
    Contributor

    Hi @dimaslanjaka, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.

  7. v-gowridurgad commented on Jun 15, 2026

    @v-gowridurgad
    Contributor

    Hi @dimaslanjaka, Just a gentle reminder regarding this issue, If you have any updates or need further assistance, Please let us know.

  8. dimaslanjaka commented on Jun 17, 2026

    @dimaslanjaka
    Author

    currently i removed yarnPath between monorepo workspace (.yarnrc.yml), and work. so, on yarn version 4.14 not support mixed version (strict) like previous version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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