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

Can no longer use lerna publish, fails with error #2315

Closed
phun-ky opened this issue Oct 22, 2019 · 6 comments
Closed

Can no longer use lerna publish, fails with error #2315

phun-ky opened this issue Oct 22, 2019 · 6 comments

Comments

@phun-ky
Copy link

phun-ky commented Oct 22, 2019

We can no longer publish packages when using lerna publish, it fails with error:

ERR! lerna bump must be an explicit version string _or_ one of: 'major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease', 'from-git', or 'from-package'.

It seems I'm suddenly hitting this:

if (!semver.valid(choice) && semverKeywords.indexOf(choice) === -1) {

For no apparent reason..

Expected Behavior

Using this unchanged command:

$ lerna publish --exact --loglevel=warn --registry=https://<projec>.myget.org/F/<category>/auth/<token>/npm/ --yes --no-verify-access --no-verify-registry -- --unsafe-perm --loglevel=warn

I expect that packages are published

Current Behavior

I'm getting the formentioned error.

Possible Solution

This worked 7+ days ago, did something break? A breaking change?

Steps to Reproduce (for bugs)

Run above command

lerna.json

{
  "lerna": "2.11.0",
  "packages": [
    "packages/*"
  ],
  "changelog": {
    "repo": "...",
    "cacheDir": ".changelog",
    "labels": {
      "problems: breaking change": "💥 Breaking Change",
      "additions: feature": "✨ New Feature",
      "problems: bug": "🐛 Bug Fix",
      "improvements: enhancement": "💅 Enhancement",
      "improvements: upgrade deps": "⬆️ Upgrade deps",
      "improvements: optimization": "⚡️ Optimization",
      "mindless: chore": "🏠 Internal",
      "mindless: documentation": "📝 Documentation"
    }
  },
  "version": "8.3.6",
  "command": {
    "init": {
      "exact": true
    },
    "publish": {
      "message": "chore(release): :bookmark: publish %s ***NO_CI***",
      "conventionalCommits": true,
      "npmClient": "npm",
      "verifyAccess": false,
      "verifyRegistry": false,
      "registry": "---"
    }
  }
}

Context

Cant publish packages

Your Environment

Executable Version
lerna --version 3.18.2, works locally with 3.13.0 (package) or 3.4.0 (global)
npm --version latest from build environment
node --version v8.14.0 or higher
OS Version
Ubuntu 18.04
@evocateur
Copy link
Member

This is definitely a bug, thanks for the report. I believe I have a workaround.

@evocateur
Copy link
Member

Also, note that arguments after -- are no longer passed to subprocess executions of npm, since v3.7.0.

@evocateur
Copy link
Member

v3.18.3

@phun-ky
Copy link
Author

phun-ky commented Oct 22, 2019

@evocateur thanks! btw, where can I find documentation on the subprocess executions? (passing args after -- ?

@evocateur
Copy link
Member

https://github.com/lerna/lerna/tree/master/commands/exec#usage and https://github.com/lerna/lerna/tree/master/commands/run#usage are the places that document when/if a -- is necessary. Those are the only commands that need it.

@hjr3
Copy link

hjr3 commented Feb 14, 2023

I ran into this error due to an empty string at the end of the publish command:

lerna publish --yes --npm-tag latest --repo-version 1.0.0 '' - notice the '' at the end.

The above publish command was generated inside a bash function that sometimes took a parameter:

lerna_publish_to () {
  lerna publish --yes --npm-tag latest --repo-version 1.0.0 "$1"
}

When the parameter was not included in the function call, we get the above command and lerna throws the error.

lerna_publish_to --skip-git # works
lerna_publish_to # fails

The fix is some arcane bash:

lerna_publish_to () {
  lerna publish --yes --npm-tag latest --repo-version 1.0.0 ${1:+"$1"}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants