记录npm publish 404的问题

2023-07-25阅读(1996)评论(0)牵着狗狗看MM

苏州实时公交查询

最近改写某编辑器源码,由于作者长时间不更新,索性自己fork一份代码,做修改

修改完后,需要发布到npm ,原作者用了lerna做多packages发布,一顿操作后卡在最后一步发布上,报错信息如下

lerna info auto-confirmed
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 404 https://registry.npmjs.com/@w3cways-editor%2fbasic-modules 449ms
lerna ERR! E404 Not found
error Command failed with exit code 1.

各种搜索,百度,谷歌,chatGPT,看了NPM发布scope包的 文档 https://docs.npmjs.com/creating-and-publishing-scoped-public-packages

切到单个package下使用npm publish --access public发布也不行,也报如下错误

npm ERR! code E404
npm ERR! 404 Not Found - PUT https://registry.npmjs.com/@w3cways-editor%2fcore - Not found
npm ERR! 404
npm ERR! 404  '@w3cways-editor/core@1.3.1' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

网上也有资料说没有npm没有登录,尝试了如下命令,也都无效

npm login 
npm config set access public
npm config set scope w3cways-editor
npm config get registry //返回的是https://registry.npmjs.org/,也没问题

后来转念一想,会不会是包文件中的package.json里的publishConfig配置不一致导致的,于是尝试修改每个包里的package.json中的publishConfig.registry 为“https://registry.npmjs.org/”,与npm config get registry的保持一致

"publishConfig": {
    "access": "public",
    "registry": "https://registry.npmjs.org/" //修改前为https://registry.npmjs.com/
  },

然后就发布成功了,踩坑留念!!

二开wangeditor5,解决各种中文输入问题

 

赞(3)
转载请注明来源:Web前端(W3Cways.com) - Web前端学习之路 » 记录npm publish 404的问题
分享到: 更多 (0)