小编Kar*_*ari的帖子

vsts-npm-auth 存在代码 1,输入不是有效的 Base-64 字符串

我已将我的项目配置为通过 .npmrc 文件使用私有 Azure DevOps 源。

我有一个执行以下操作的 .js 脚本:

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)    
}});
Run Code Online (Sandbox Code Playgroud)

当它第一次在 $env:USERPROFILE.npmrc 文件下创建 .npmrc 文件时,一切都很好。

文档说,如果 -F 标志“不存在或为假,则目标配置文件中的现有令牌只有在接近或过期时才会被替换”。所以重新运行脚本作为我项目构建步骤的一部分应该没问题。

但是,有时我在'vsts-npm-auth -R -C ' + npmrc_location'执行时遇到以下错误:

vsts-npm-auth v0.41.0.0:
The input is not a valid Base-64 string as it contains a non-base 64 character, …
Run Code Online (Sandbox Code Playgroud)

npm .npmrc

13
推荐指数
2
解决办法
3137
查看次数

标签 统计

.npmrc ×1

npm ×1