Skip to content
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

Error when exec executables in monorepo submodule's .bin #6794

Open
RoyRao2333 opened this issue Jul 11, 2023 · 0 comments
Open

Error when exec executables in monorepo submodule's .bin #6794

RoyRao2333 opened this issue Jul 11, 2023 · 0 comments

Comments

@RoyRao2333
Copy link

RoyRao2333 commented Jul 11, 2023

pnpm version:

v8.6.7 and v7.33.3

Code to reproduce the issue:

I'm configuring a CLI package using Commander.js, zx and gitlab-cli to make merge requests.

Let's say I have a project structure below:

|--package.json
|--node_modules/
    |--.bin
        |--cli
|--packages/
    |--client/
        |--package.json
        |--node_modules/
            |--.bin
                |--lab
    |--...

In my root's package.json:

{
  "devDependencies": {
    "client": "workspace:*"
  }
}

In client's package.json:

{
  "dependencies": {
    "git-lab-cli": "2.0.7"
  }
}

Expected behavior:

Should successfully make merge requests with no errors.

Actual behavior:

If I run my custom command in my CLI

pnpm cli mr

that is running with zx

await $`pnpm --filter=client exec lab merge-request -b myBranch -t master -m myBranch`

and it actually runs

pnpm --filter=client exec lab merge-request -b myBranch -t master -m myBranch

The gitlab-cli works fine but I got an error at the end of the output:

undefined
/Users/royrao/Desktop/rd/shared/packages/client:
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: lab merge-request -b myBranch -t master -m myBranch

Dont know where did the undefined come from since I didn't log anything in my code. And this error gave me no reason why it failed.

But if I install gitlab-cli in the root's package.json and run

pnpm lab merge-request -b myBranch -t master -m myBranch

then everything is fine.

I got above errors using pnpm v8.6.7, but if I use v7.33.3, the error looks different:

/Users/royrao/Desktop/rd/shared/packages/client:
 ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 1: lab merge-request -b myBranch -t master -m myBranch
 ERROR  Command failed with exit code 1: pnpm --filter=client exec lab merge-request -b myBranch -t master -m myBranch

pnpm: Command failed with exit code 1: pnpm --filter=client exec lab merge-request -b myBranch -t master -m myBranch
    at makeError (/Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:24796:17)
    at handlePromise (/Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:25367:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.handler [as dlx] (/Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:209900:7)
    at async /Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:219307:21
    at async main (/Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:219274:34)
    at async runPnpm (/Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:219529:5)
    at async /Users/royrao/.nvm/versions/node/v18.16.0/lib/node_modules/pnpm/dist/pnpm.cjs:219521:7

Additional information:

May be relevant to #4481

  • Node v18.16.0
  • macOS 13.4.1
@RoyRao2333 RoyRao2333 changed the title Error when exec executables in monorepo submodules' .bin Error when exec executables in monorepo submodule's .bin Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant