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

Lerna with npm 2FA (npm otp) #1137

Closed
Bamieh opened this issue Nov 23, 2017 · 11 comments
Closed

Lerna with npm 2FA (npm otp) #1137

Bamieh opened this issue Nov 23, 2017 · 11 comments
Milestone

Comments

@Bamieh
Copy link

Bamieh commented Nov 23, 2017

After assigning 2FA on my npm account, lerna fails to publish (unless i publish once manually first for each package!)

Expected Behavior

Current Behavior

lerna publish fails if otp is added to the npm account of the publisher, there is no way through lerna to pass the otp.

Possible Solution

pass otp to npm if otp options i passed to lerna:

$ lerna publish --otp=123456`

Steps to Reproduce (for bugs)

  1. install OTP to the npm account
  2. try to publish through lerna
lerna-debug.json

lerna info publish Publishing packages to npm...
lerna ERR! publish Retrying failed publish: reflow-core
lerna ERR! publish Retrying failed publish: reflow-core
lerna ERR! publish Retrying failed publish: reflow-core
lerna ERR! publish Retrying failed publish: reflow-core
lerna ERR! publish Ran out of retries while publishing reflow-core Error: Command failed: npm publish --tag latest
lerna ERR! publish npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
lerna ERR! publish npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` for upload-only.
lerna ERR! publish npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
lerna ERR! publish npm ERR! publish Failed PUT 401
lerna ERR! publish npm ERR! code E401
lerna ERR! publish npm ERR! 404 You must provide a one-time pass. : reflow-core

Context

Cannot publish packages anymore through lerna without going through the hassle of manually publishing each package once to add the otp. Or turning off the 2fa completely.

Your Environment

Executable Version
lerna --version 2.4.0
npm --version 5.5.1
node --version v8.5.0
@Bamieh Bamieh changed the title Lerna with npm 2FA Lerna with npm 2FA (npm otp) Dec 18, 2017
@Bamieh
Copy link
Author

Bamieh commented Dec 18, 2017

Could someone kindly provide any updates on this issue?

@rickmak
Copy link

rickmak commented Dec 22, 2017

I discovered in npm doc: https://docs.npmjs.com/misc/config#environment-variables You may give a try to NPM_CONFIG_OTP.

@vvo
Copy link

vvo commented Jan 28, 2018

Was not able to use npm_config_otp, it does not change anything. Maybe because I am also using npmClient: yarn and yarn does not support that?

@vvo
Copy link

vvo commented Jan 28, 2018

cc @neoziro is this working for you? What's the command line you are using exactly?

@gregberge
Copy link

NPM_CONFIG_OTP=123456 lerna publish

But I finally turn two factor authentication on npm to auth-only and I am very happy 👍.

@vvo
Copy link

vvo commented Jan 28, 2018

Indeed that ease the process, here's how to do it:

npm profile disable-2fa
npm profile enable-2fa auth-only

thx @neoziro

@rickmak
Copy link

rickmak commented Jan 29, 2018

Sometime NPM_CONFIG_OTP is not working as the publishing take too long. The provided OTP just expired.

I am currently using lerna exec 'npm publish' and wait for the OTP prompt.

@Bamieh
Copy link
Author

Bamieh commented Jan 29, 2018

@rickmak true, i wrote a custom bash script for the publishing but was faced with this issue (1 otp is not enough sometimes). my solution to this was to use 2fa in auth-only mode only

@freaktechnik
Copy link

This seems to be the same issue as #1091 except that it is less specific about how to solve the issue?

@evocateur
Copy link
Member

Closing as a duplicate of #1091

@lock
Copy link

lock bot commented Dec 27, 2018

This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants