npm 无法解析主机名github.com:名称或服务未知

fhity93d  于 2023-03-03  发布在  Git
关注(0)|答案(1)|浏览(286)

已开始接收错误;Could not resolve hostname github.com: Name or service not known在将我们的npm版本从6.14.14更新为8.1.2之后,当尝试针对我们的private软件包运行npm publish到我们的private注册表时。
我们的package.json配置有"private": true,并且我们还在构建服务器上的本地.npmrc文件中配置了我们的私有注册表。

> npm publish dist/{{project}}
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/dist/{{project}}.git
npm ERR! ssh: Could not resolve hostname github.com: Name or service not known
npm ERR! fatal: Could not read from remote repository.
npm ERR! 
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

为什么这个更新版本的npm要发布到github.com?
将构建代理目标切换回6.14.14安装不会尝试发布到github.com,并成功地将其发布到我们的私有注册表。

lyr7nygr

lyr7nygr1#

在迁移到节点16和npm 8后,我遇到了这个问题:
对于this issue,发布路径需要一个尾部斜杠。
所以npm publish dist/myProject应该是npm publish dist/myProject/

相关问题