depends on incompatible version of commander
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
node-yarnpkg (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Issue affects Jammy with nodepkg 1.22.10+
Fixed upstream in Debian (bug 1019291) by 1.22.19+
Original bug report from Debian issue tracker follows:
---
The current version of node-commander in Debian testing an unstable in 9.4.0.
However, this version is not fully compatible
with the current version of yarn.
For some packages, you will get something like this:
yarn run v1.22.19
TypeError: _commander(
at /usr/share/
at Array.findIndex (<anonymous>)
at _callee$ (/usr/share/
at tryCatch
(/usr/share/
at Generator._invoke
(/usr/share/
at Generator.next
(/usr/share/
at asyncGeneratorStep
(/usr/share/
at _next
(/usr/share/
at /usr/share/
at new Promise (<anonymous>)
The short summary is that yarn tries to use the "optionFor" feature of
commnder,
but as far as I can tell, the last version of commander that still had
optionFor was version 4.1.1;
it has been removed by the time 5.0.0 has been released.
The upstream yarn package depends on "^2.9.0", so the currently packaged 9.4.0
definitely doesn't satisfy it.
Changed in node-yarnpkg (Ubuntu): | |
status: | New → Incomplete |
status: | Incomplete → New |
I have come up with a fix on yarnpkg that apparently will make it compatible with the newer version of commander. That could be used until someone ports the new version of yranpkg/berry to debian repositories:
```diff 1.22.19. orig/src/ cli/index. js 1.22.19/ src/cli/ index.js (arg, idx, arr) => { '-'); ('-') && commander. optionFor( prev); ('-') && commander. options. find(option => option.is(prev)); optional || prevOption. required) ;
--- node-yarnpkg_
+++ node-yarnpkg_
@@ -147,7 +147,7 @@ export async function main({
const firstNonFlagIndex = args.findIndex(
const isOption = arg.startsWith(
const prev = idx > 0 && arr[idx - 1];
- const prevOption = prev && prev.startsWith
+ const prevOption = prev && prev.startsWith
const boundToPrevOption = prevOption && (prevOption.
return !isOption && !boundToPrevOption;
```
I did not send this patch to the upstream as they do not accept non-security fixes for their older yarnpkg/yarn module, but I have used it on my PPA for Ubuntu 22.04 jammy series: https:/ /launchpad. net/%7Emrazavi/ +archive/ ubuntu/ gvm?field. series_ filter= jammy
I propose to use this patch on the Ubuntu universe repositories until yarnpkg/berry is available. The latest version of yarnpkg even in lunar series will throw errors when you provide multiple arguments, for example:
yarnpkg -s -h
After installing the version from my PPA which includes this patch, the problem disappears.