You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

为何NPM 8+中npm config set always-auth不是有效选项?Travis报错

解决NPM 8+下always-auth配置报错的问题

问题根源

NPM 8及更高版本已经移除了全局的always-auth配置项,所以你之前尝试的几种全局设置写法都会触发“无效选项”的错误。

正确配置方法

必须针对你使用的特定注册表来设置该选项,格式为:

npm config set //<你的注册表地址>/:always-auth true

举几个实际场景的例子:

  • 若使用官方npm注册表:
    npm config set //registry.npmjs.org/:always-auth true
    
  • 若你预先设置了自定义注册表(比如https://private-registry.example.com):
    npm config set //private-registry.example.com/:always-auth true
    

确认配置生效

执行以下命令查看配置列表,确认对应注册表的:always-auth值为true:

npm config list

内容的提问来源于stack exchange,提问作者Ethan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.10 06:46:07