lerna: publish in v3 fails with older versions of npm, worked with v2
Expected Behavior
I expect that after upgrading to lerna@3, lerna publish works without doing changes to my npm authentication setup.
Current Behavior
Fails with:
lerna ERR! ENEEDAUTH You must be logged in to publish packages. Use `npm login` and try again.
It works to go into the individual packages to just npm publish.
Steps to Reproduce (for bugs)
- Upgrade to lerna 3
- Try to push to a private repository, which worked with lerna 2
lerna.json
{
"packages": [
"packages/*"
],
"changelog": {
"repo": "<organization>/<project>
"cacheDir": ".changelog",
"labels": {
"problems: breaking change": ":boom: Breaking Change",
"additions: feature": ":rocket: New Feature",
"problems: bug": ":bug: Bug Fix",
"improvements: enhancement": ":nail_care: Enhancement",
"improvements: upgrade deps": ":arrow_up: Upgrade deps",
"mindless: chore": ":house: Internal",
"mindless: documentation": ":memo: Documentation"
}
},
"version": "1.10.26",
"command": {
"init": {
"exact": true
},
"publish": {
"message": "chore(release): :bookmark: publish %s",
"conventionalCommits": true,
"npmClient": "npm"
}
}
}
Possible related to https://github.com/lerna/lerna/issues/1560
Context
Publishing fails in our deployment cycle.
Your Environment
| Executable | Version |
|---|---|
lerna --version |
3.0.6 |
npm --version |
6.4.0 |
node --version |
8.10.0 |
| OS | Version |
|---|---|
| NAME | VERSION |
| Ubuntu | 16.04 LTS |
Npm stuff
.npmrc:
@scope2:registry=https://waypoint.myget.org/F/scope2/npm/
//waypoint.myget.org/F/scope2/npm/:_authToken=${SCOPE2_NPM_TOKEN}
How I logged into the private registry:
npm adduser --registry=https://waypoint.myget.org/F/scope2/npm/ --scope=@scope2
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 5
- Comments: 26 (9 by maintainers)
Commits related to this issue
- Force use npm 6 as commented on https://github.com/lerna/lerna/issues/1573#issuecomment-434271662 — committed to react-page/react-page by fernandobandeira 5 years ago
Today we updated
lernafrom3.0.0-rc.0to3.3.0and are facing similiar problem - we are usingyarnand default npm registry (not custom one).We use this cmd:
lerna.json ( https://github.com/gatsbyjs/gatsby/blob/9ce045aa4f0a96802ccf5fd3a60f25afc574a8dc/lerna.json ):
During the publish we get:
we are actually logged in and without any additional
npm logincan actually publish packages manually withyarn publish.But biggest problem is that publish commit (and tags) get pushed to repository (without actually publishing packages) - https://github.com/gatsbyjs/gatsby/commit/938d168acb72b857410b98a0ec4d2a9b65adbd37 and we have to follow that with manual
yarn publish --tag nextto actually publish package. Any clues?I ran into the “Cannot read property ‘algorithm’ of undefined” error and, like @darkobits, discovered that
lernawas trying to usenpm: 5.1.0when publishing.npm ls npmshowed that the older npm version was coming from another dependency (gitbook-cliin this case).I ran
npm i npm@^6and tried publishing again and this time it there was no issues. Hope this helps someone.@Inlustra Wonderful context, thank you! I do believe this might be related to older versions of npm.
I know there is even a still-unfixed(!) bug since v5.7.0 related to “legacy” auth and npm Enterprise (possibly all third-party?) registries.
npx npm@5.6.0 loginis necessary, even with npm 6-latest, to create an auth token for our npm Enterprise instance (once created, it is no longer necessary to run npm@5.6.0).So, in summary, it looks like Yet Another Version Test (
npmClient === "npm" && npm -v < 5.6.0) is needed to condense the newly-split “pack-then-publish” routine into the legacy “just-publish” method…