Skip to content

docs: The url to the yarn corepack documentation is not found (invalid url) when corepack is enabled for the repo, but not the action. #1206

Closed
@jpbnetley

Description

@jpbnetley

Description:
When corepack is enabled with the new version of yarn 4 (in my case yarn@4.6.0).
The action specifies the following:

Run actions/setup-node@v4
Found in cache @ /opt/hostedtoolcache/node/20.18.1/x64
Environment details
/usr/local/bin/yarn --version
1.22.22
/usr/local/bin/yarn cache dir
error This project's package.json defines "packageManager": "yarn@4.6.0". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from [16](https://github.com/AlbatrosEng/a9-cwi-client/actions/runs/12948571237/job/36117499630?pr=172#step:3:18).9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
Error: error This project's package.json defines "packageManager": "yarn@4.6.0". However the current global version of Yarn is 1.22.22.

Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.[19](https://github.com/AlbatrosEng/a9-cwi-client/actions/runs/12948571237/job/36117499630?pr=172#step:3:21).
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.

I noticed that the link provided in the error is not found, because it includes a full stop.
The link should be https://yarnpkg.com/corepack and not https://yarnpkg.com/corepack.

Action version:
v4

Platform:

  • Ubuntu
  • macOS
  • Windows

Runner type:

  • Hosted
  • Self-hosted

Tools version:

  • N/A

Repro steps:
I used the migration docs here to upgrade from yarn 1 to the new version.
But I think it can be re-produced with the following:

  • create a repo with yarn.
  • Then enable corepack for yarn
    corepack enable
  • Update yarn to the latest with yarn set version berry
  • And then let the github action run

The action I use as an example:

  name: Code Validation

on:
  workflow_call:

env:
  node_version: 20

jobs:
  tests:
    name: Test
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v4

    - name: Use Node.js ${{ env.node_version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ env.node_version }}
        cache: 'yarn'

    - uses: actions/cache@v4
      id: npm-cache
      with:
        path: node_modules
        key: ${{ runner.os }}-${{ env.node_version }}-node-${{ hashFiles('**/yarn.lock') }}
        restore-keys: ${{ runner.os }}-${{ env.node_version }}-node-
      
    - name: Install    
      if: steps.npm-cache.outputs.cache-hit != 'true'  
      run: yarn

Expected behavior:
Expect the action to fail, but the link to yarn corepack should be correct https://yarnpkg.com/corepack

Actual behavior:
The link to the yarn corepack docs is incorrect, as it includes a full stop in the url https://yarnpkg.com/corepack.

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