question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] `dlx` on packages with a single binary doesn't execute it if the name doesn't match the package

See original GitHub issue
  • I’d be willing to implement a fix

Describe the bug

I cannot run yarn dlx @yarnpkg/pnpify --sdk vscode with a private registry on Azure Artifacts.

Internal Error: Binary not found (pnpify) for root-workspace-0b6124@workspace:.

To Reproduce (Sherlock)

const installPromise = packageJsonAndInstall({
  dependencies: {
  },
});

// arrange private registry
await yarn(`config`, `set`, `npmRegistryServer`, `https://pkgs.dev.azure.com/it-casado/yarn-bugs/_packaging/yarn-bugs/npm/registry`);

await yarn(`config`, `set`, `npmRegistries["//pkgs.dev.azure.com/it-casado/yarn-bugs/_packaging/yarn-bugs/npm/registry"].npmAlwaysAuth`, `true`);
await yarn(`config`, `set`, `npmRegistries["//pkgs.dev.azure.com/it-casado/yarn-bugs/_packaging/yarn-bugs/npm/registry"].npmAuthIdent`, `eWFybi1idWdzOnM2Z2o3b3IzZGNicTY1cHVyZHdoZ282bnNoNnljZHRzMm43ZXZ3dG55YW8zc2lmb2F0bWE=`);

// act
const output = await yarn(`dlx`, `@yarnpkg/pnpify`, `--sdk`, `vscode`);

// assert
expect(output).not.stringContaining(`Internal Error: Binary not found (pnpify) for root-workspace`);

To Reproduce (Manual)

  1. .yarn.yml
npmRegistries:
  //pkgs.dev.azure.com/it-casado/yarn-bugs/_packaging/yarn-bugs/npm/registry:
    npmAlwaysAuth: true
    npmAuthIdent: eWFybi1idWdzOnM2Z2o3b3IzZGNicTY1cHVyZHdoZ282bnNoNnljZHRzMm43ZXZ3dG55YW8zc2lmb2F0bWE=

npmRegistryServer: "https:////pkgs.dev.azure.com/it-casado/yarn-bugs/_packaging/yarn-bugs/npm/registry"
  1. package.json
{
  "name": "SomeProject",
  "description": "Some project",
  "license": "MIT",
  "author": "Author",
  "version": "0.0.1",
  "devDependencies": {
    "typescript": "^4.0.3"
  }
}

Or use this GITHUB repository: https://github.com/IT-CASADO/yarn_issue_2013_repro

Side notes My authentication must be fine, because I can run yarn npm publish without any errors and I can see the published package on my private repository.

The used registry on Azure and the token (read-only) exists only for this bug. So there is no security issue here!

Using the default NPM repository works fine for me.

Environment if relevant (please complete the following information):

  • OS: [Windows]
  • Node version [10.18.3]
  • Yarn version [2.3.3]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:42 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
acton-bellcommented, Apr 11, 2021

A quick workaround* is to set a custom scope just for @yarnpkg in your .yarnrc.yml:

npmScopes:
  yarnpkg:
    npmRegistryServer: "https://registry.yarnpkg.com"

*context: we had the same issue attempting to execute yarn dlx @yarnpkgdoctor in a repository exclusively using an Azure Artifacts feed with npm as the upstream.

1reaction
arcaniscommented, Mar 31, 2021

There are two problems. One is the registry (it returns @yarnpkg/pnpify as binary name, which isn’t correct - the binary is called pnpify), one is Yarn (if there’s a single binary we should use it regardless of the package name, but we don’t).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migration | Yarn - Package Manager
A step-by-step and in-depth migration guide from Yarn 1 (Classic) to Yarn 2 (Berry).
Read more >
Advanced package manager features for npm, Yarn, and pnpm
Don't think a lot about your package manager? Learn more in this article about the advances in package manager features you may have...
Read more >
Bug listing with status RESOLVED with resolution INVALID as ...
Bug :27 - "Test" status:RESOLVED resolution:INVALID severity:normal ... does not properly handle if gpm doesn't start" status:RESOLVED resolution:INVALID ...
Read more >
Packaging Projects | Unreal Engine 4.27 Documentation
If packaging completes successfully, this directory will then contain the packaged project. Confirming the target directory will then initiate the actual ...
Read more >
How to troubleshoot app package signature errors - Win32 apps
The package may fail to install due to certificate chaining errors, even if the signing certificate is not self-signed and the root certificate ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found