"401 Unauthorized" deploying to npm package registry

Like this post: Support deploying to GitHub package registry, I can’t get how to deploy on NPM package registry. I got the following message: You must be logged in to publish packages.

What’s crazy is that before, I have the message:

Authenticate deployment
npm version: 6.13.4
Authenticated with API token 
~/.npmrc size: 33
$ npm config set registry "https://registry.npmjs.org"

So I assume I am logged in to npm.

Full CI output here: https://travis-ci.org/maximelafarie/browizard/builds/636899450#L284
Full Travis configuration: https://travis-ci.org/maximelafarie/browizard/jobs/636899451/config

It’s impossible since the log file is stored on the VM.

So I indeed got this: cat: /home/travis/.npm/_logs/2020-01-14T13_44_59_979Z-debug.log: No such file or directory

Okay, looking at the log wasn’t needed after all.

The reason is NPM_TOKEN and NPM_EMAIL envvars are not set.

This is strange because I effectively set them (but only for master branch):

Okay so you are completely right. That was because (for a reason I don’t understand) I set my variables to be available on master only… Since the deploy job is triggered only on master pushes, I can’t get how this couldn’t work. Anyway, all works perfectly and I finally can deploy to npm! Thank you very much!

https://travis-ci.org/maximelafarie/browizard/builds/636899450#L284 was a tagged build, not master, so the variables were not available to it.