berry: [Bug?]: YN0001: UsageError: No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main

Self-service

  • I’d be willing to implement a fix

Describe the bug

I read a docs about yarn version and installed module via command yarn plugin import version and run yarn version check command. In each run I get a error.

To reproduce

yarn plugin import version
yarn version check

Environment

System:
  OS: Windows 10 10.0.19044
  CPU: (12) x64 AMD Ryzen 5 4600H with Radeon Graphics
Binaries:
  Node: 16.13.2 - ~\AppData\Local\Temp\xfs-e9b3eefb\node.CMD
  Yarn: 3.2.0 - ~\AppData\Local\Temp\xfs-e9b3eefb\yarn.CMD
  npm: 8.1.2 - A:\NodeJS\npm.CMD

.yarnrc.yml

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-version.cjs
    spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
nodeLinker: node-modules

Additional context

YN0001: UsageError: No ancestor could be found between any of HEAD and master, origin/master, upstream/master, main, origin/main, upstream/main at Object.wAe ($root_.node\corepack\yarn\3.2.0\yarn.js:595:7874) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async $v ($root.yarn\plugins@yarnpkg\plugin-version.cjs:433:8625) at async $root.yarn\plugins@yarnpkg\plugin-version.cjs:446:10281 at async Function.start ($root_.node\corepack\yarn\3.2.0\yarn.js:413:2373) at async t_.executeStandard ($root.yarn\plugins@yarnpkg\plugin-version.cjs:446:10192) at async t_.execute ($root.yarn\plugins@yarnpkg\plugin-version.cjs:446:3414) at async t_.validateAndExecute ($root_.node\corepack\yarn\3.2.0\yarn.js:349:673) at async Is.run ($root_.node\corepack\yarn\3.2.0\yarn.js:363:2087) at async Is.runExit ($root_.node\corepack\yarn\3.2.0\yarn.js:363:2271)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

Unfortunately npm version doesn’t work if you have any workspace dependencies. And yarn version makes a lot of assumptions when we just want to change version in a json file programmatically.

I’m seeing a theme with some of these issues: don’t use yarn.

Struggled with this for a bit and then realised --help exists:

npm version 0.0.1 --no-git-tag-version --workspace=my.workspace --no-workspaces-update

Struggled with this for a bit and then realised --help exists:

npm version 0.0.1 --no-git-tag-version --workspace=my.workspace --no-workspaces-update

I want to use yarn version plugin not npm. )). For now I found a better tools for versioning and I don’t need anymore to yarn version plugin

Figured out the issue - as it says in the error it could not find any of “master, origin/master, upstream/master, main, origin/main, upstream/main” branches.

I think this issue stems from the fact that the legacy tool only updated the version while the yarn 2 plugin does a lot more.

npm still retains the old behaviour so the solution could be this:

npm version patch --no-git-tag-version