使用npm发布组件采坑记录

690 阅读1分钟

使用npm login登录成功之后,npm publish发布组件时一直出现下面提示, npm ERR! code ENEEDAUTH npm ERR! need auth This command requires you to be logged in. npm ERR! need auth You need to authorize this machine using npm adduser

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\admin\AppData\Local\npm-cache_logs\2022-03-22T12_15_49_453Z-debug.log 提示我未登录 一直要我登录,再尝试了n变重新登录之后还是不行,最后找到了.npmrc文件,发现里边的两个镜像地址不对,一个是npm自己的镜像,一个是淘宝的镜像。把两个镜像都删掉,重新登录,发布成功。大坑 切换npm镜像npm config set registry https:``//registry.npmjs.org/