Skip to content

yarn install in subdirectory ignores --cwd and fails due to Corepack conflict #298

@navfarm

Description

@navfarm

Hi @Borales

I'm using the borales/actions-yarn@v4 action in a GitHub Actions workflow to run yarn install in a specific subdirectory of my project. However, the action seems to be ignoring the --cwd option and looking at the root package.json instead of the one in the specified subdirectory.

Furthermore, I'm encountering an error related to Corepack:

error This project's package.json defines "packageManager": "yarn@pnpm@9.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.

Corepack must currently be enabled by running corepack enable in your terminal  

This error suggests that Corepack might be interfering with the yarn install command and causing unexpected behavior.

I've tried the following configuration:
YAML

- name: Run install
  uses: borales/actions-yarn@v4
  with:
    cmd: install
    dir: <sub directory>

I expect the yarn install command to be executed within the specified subdirectory, using its package.json and yarn.lock files. However, it's currently affecting the entire project.

I'm looking for guidance on how to correctly configure the yarn install command to target the subdirectory and resolve the Corepack-related issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions