You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
NPM package can't be published with publib when 2FA is configured in the target NPM account.
Details
npm publish command used in publib-npm (source) requires an --opt flag when 2FA is configured. There's no equivalent env variable according to NPM docs.
Workaround
I was able to publish an NPM package by editing publib sources in node_modules. I added the --otp flag in node_modules/.bin/publib-npm:
npm publish ${tag}${access}${file} --otp <my_temp_code>2>&1| tee ${log}
Suggested Solution
An NPM_OTP_TOKEN env variable could be supported by publib and used as the --otp flag value in the npm publish command. This won't be the optimal solution, though, as the OTP token is short-lived and will have to be updated right before running the publib command. A better solution would be to somehow allow npm publish to run in interactive mode and prompt the user for the OTP token. (see NPM OTP option docs).
The text was updated successfully, but these errors were encountered:
Problem
NPM package can't be published with
publib
when 2FA is configured in the target NPM account.Details
npm publish
command used inpublib-npm
(source) requires an--opt
flag when 2FA is configured. There's no equivalent env variable according to NPM docs.Workaround
I was able to publish an NPM package by editing
publib
sources innode_modules
. I added the--otp
flag innode_modules/.bin/publib-npm
:Suggested Solution
An
NPM_OTP_TOKEN
env variable could be supported bypublib
and used as the--otp
flag value in thenpm publish
command. This won't be the optimal solution, though, as the OTP token is short-lived and will have to be updated right before running thepublib
command. A better solution would be to somehow allownpm publish
to run in interactive mode and prompt the user for the OTP token. (see NPM OTP option docs).The text was updated successfully, but these errors were encountered: