I'm trying to automate npm publish inside a Docker container, but I receive an error when the npm login command tries to read the username and email:
npm login << EOF
username
password
email
EOF
It works in a Bash terminal, but in a container (without stdin) it shows error:
Username: Password: npm ERR! cb() never called!
npm ERR! not ok code 0
According to npm-adduser:
The username, password, and email are read in from prompts.
How can I run npm login without using stdin?
You could use an expect script instead or write a node script that uses pty.js.