I have configured my project to use private Azure DevOps feed through .npmrc file.
I have a .js script that does the following:
const { exec } = require('child_process');
const npmrc_location = ...
const commands =
[
'npm install vsts-npm-auth --registry https://registry.npmjs.com --always-auth false --no-save',
'vsts-npm-auth -R -C ' + npmrc_location
];
exec(commands.join('&&'), (error) => {
if (error) {
console.log(error)
}});
When it first creates the .npmrc file under $env:USERPROFILE.npmrc file, everything is fine.
The documentation says that if the -F flag is "absent or false, an existing token in the target configuration file will only be replaced if it is near or past expiration." So re-running the script as part of the building step of my project should be fine.
However, there are times when I run into the following error when 'vsts-npm-auth -R -C ' + npmrc_location'
is executed:
vsts-npm-auth v0.41.0.0: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters..
My best guess is that it tries to read the content of .npmrc file.
Does anyone know why this can happen and what would be a good solution for it?
Thanks