I want to automate the npm login process via a bash script.
I tried it with this snippet:
/usr/bin/expect -f - <
@Aurélien Thieriot: thanks for the hint.
I have two solutions for my problem:
export NPM_AUTH_TOKEN=myToken
export NPM_EMAIL=myEmail
create/override ~/.npmrc
by following shell script:
echo "_auth = $NPM_AUTH_TOKEN" > ~/.npmrc
echo "email = $NPM_EMAIL" >> ~/.npmrc
export NPM_USERNAME=myUsername
export NPM_PASSWORD=myPassword
export NPM_EMAIL=myEmail
I know the order of the questions. So I can do the following:
npm adduser <
Note: solution 2 works only when the user isn't added yet
Otherwise the $NPM_PASSWORD
is not necessary