npm publish报错: 426 Upgrade Required
今天更新一个npm包的时候,npm login 和 npm publish之后,出现了426 Upgrade Required
的报错。
报错log:
npm login
Username: ***
Password: ***
Email: (this IS public) ***
npm ERR! code E426
npm ERR! 426 Upgrade Required - PUT http://registry.npmjs.org/-/user/org.couchdb.user:dulinyu
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\86139\AppData\Local\npm-cache\_logs\2021-11-10T07_28_13_099Z-debug.log
复制代码
首先查资料发现npm发版安全升级了,需要升级node 版本
2021年10月4日后,npm 网站和 npm registry 必须使用 TLS 安全套接层 1.2 版本,所以需要升级对应版本
于是网上这么说:
What I did:
- upgrade Node (0) to its current recommended version: 14.18.0 LTS
- upgrade npm with
npm install -g npm@latest
In my case, I had to manually set the registry to use https instead of http as well:
npm config set registry https://registry.npmjs.org/
(0) When using nvm, that’s what you need to do:
nvm install 14.18.0
nvm use 14.18.0
nvm alias default 14.18.0
据说还可以这样解决:
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
npm config set registry https://registry.npmjs.org
我是:
自己下载了最近稳定的版本14.8.1
还是报这个错
然后费解了
寻寻觅觅发现
npm 登录和发版的 registry 我手残设置的是 http://registry.npmjs.org/
应该是 npm config set registry https://registry.npmjs.org/
https的
版权声明:本文为mrzhangdulin原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。