從2021年10月4日開始,所有與npm網站和npm注冊表的連接(包括軟體包安裝)必須使用TLS 1.2或更高版本,
很多朋友在發布npm包時可能會遇到提示:
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more inf
ormation: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm ERR! code E426
這時候可以首先將npm鏡像地址設為https的地址:
npm config set registry https://registry.npmjs.org
然后再嘗試發布,如果還是報錯,可以運行以下命令支持TLS 1.2:
npm install -g https://tls-test.npmjs.com/tls-test-1.0.0.tgz
運行完會收到提示:
Hello! The tls-test package was successfully downloaded and installed. Congratulations! Your package manager appears to support TLS 1.2.
如果收到錯誤提示,可以升級node到包含npm7以上的版本以支持TLS1.2,升級完檢查下npm版本,如果沒到7.0可以按照提示升級到7.0以上,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/307332.html
標籤:其他
