[npm]npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
问题描述
公司搭建的私服,在线上环境中,项目打包出现以下错误:
[ERROR] npm ERR! code E401
[ERROR] npm ERR! Unable to authenticate, need: BASIC realm="Sonatype Nexus Repository Manager"
解决方案
本地出现权限问题的时候可以执行:
npm config set //nexus.xxx.xx/repository/npm-group/:_authToken NpmToken.73ba43bd-dd91-3746-90bf-6d1f583385d2
然后.npmrc 文件中出现//nexus.xxx.xx/repository/npm-group/:_authToken NpmToken.73ba43bd-dd91-3746-90bf-6d1f583385d2
设置 npm 的 token