1

Im running this command:

$npm login --registry=https://npm.pkg.github.com
> Username: USERNAME 
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS

It asks for username, password and email with interactive prompt. I want bash command to autofill these values.

I tried:

echo -e "$username\n$password\n$email" | npm login --registry=https://npm.pkg.github.com
printf "%s\n" "$username $password $email" | npm login --registry=https://npm.pkg.github.com

It fills the username but gives error while filling password. Got the same error in each case:

Username: username
Password: npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2020-07-28T13_23_22_829Z-debug.log
Nikhil Singh
  • 21
  • 1
  • 3
  • Not sure if the npm command has options for this kind of non-interactive usage. For a generic solution you need to use tools like [tag:expect]. If you don't want to learn another language you can use my [sexpect (Expect for Shells)](https://github.com/clarkwang/sexpect). – sexpect - Expect for Shells Jul 28 '20 at 14:19
  • Possible duplcate https://stackoverflow.com/questions/23460980/set-up-npm-credentials-over-npm-login-without-reading-input-from-interactively – Joao Vitorino Jul 28 '20 at 15:32

0 Answers0