例如,我们在 npm 登录 Nexus 的仓库的时候提示错误如下:npm ERR! code E401 npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager" npm ERR! A complete log of this run can be found in: npm ERR! C:UsersYuChengHuAppDataLocal pm-cache_logs2022-10-26T20_09_51_660Z-debug-0.log 问和解决 上面的问题在于 Nexus 的 realm 配置。 把 Nexus 的 NPM 配置移动到右侧即可。