解决lerna publish出现的400错误(lerna ERR! E400 [maintainers_error]...)

1,757 阅读1分钟

【问题场景】

通过lerna发布在公司的私有库(通过cnpm搭建的)时出现如下错误:

lerna info execute Skipping releases
lerna info git Pushing tags...
lerna info publish Publishing packages to npm...
lerna notice Skipping all user and access validation due to third-party registry
lerna notice Make sure you're authenticated properly ¯\_(ツ)_/¯
lerna http fetch PUT 400 http://npm.dxy.net:7001/@dxy%2frcpress-core 78ms
lerna ERR! E400 [maintainers_error] request body need maintainers

而通过npm publish(已做过相关配置) 直接发布再私有仓库是没问题的。怀疑是lerna的发布或者私有库的相关配置的问题,时间紧,以后再看。

解决方案

这里尝试通过在每个包里添加maintainers字段解决

  "maintainers": [
    "xxx1",
    "xxx2"
  ],

这样为每个包配置以后,再通过lerna发布就没有问题了。