英文:
Could not resolve hostname github.com: Name or service not known
问题
Started receiving the error; Could not resolve hostname github.com: Name or service not known
after updating our npm version from 6.14.14
to 8.1.2
when trying to run npm publish
against our private package to our private registry.
我们在将 npm 版本从 6.14.14
更新到 8.1.2
后,在尝试将 私有 包发布到我们的 私有 注册表时开始收到错误信息:无法解析主机名 github.com:名称或服务未知
。
Our package.json
is configured with "private": true
and we have also configured our private registry in a local .npmrc
file on the build server.
我们的 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 publish dist/{{project}}
npm ERR! code 128
npm ERR! 发生了未知的 git 错误
npm ERR! 命令 git --no-replace-objects ls-remote ssh://git@github.com/dist/{{project}}.git
npm ERR! ssh: 无法解析主机名 github.com:名称或服务未知
npm ERR! 致命错误:无法从远程存储库读取。
npm ERR!
npm ERR! 请确保您拥有正确的访问权限
npm ERR! 并且存储库存在。
Why is this updated version of npm trying to publish to github.com?
为什么这个更新后的 npm 版本试图发布到 github.com?
Switching the build agent target back to the 6.14.14
install does not try to publish out to github.com and successfully publishes it to our private registry.
将构建代理目标切换回 6.14.14
安装不会尝试发布到 github.com,而是成功将其发布到我们的私有注册表。
英文:
Started receiving the error; Could not resolve hostname github.com: Name or service not known
after updating our npm version from 6.14.14
to 8.1.2
when trying to run npm publish
against our private package to our private registry.
Our package.json
is configured with "private": true
and we have also configured our private registry in a local .npmrc
file on the build server.
> 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.
Why is this updated version of npm trying to publish to github.com?
Switching the build agent target back to the 6.14.14
install does not try to publish out to github.com and successfully publishes it to our private registry.
答案1
得分: 1
Per this issue, the publish path needs a trailing slash.
So npm publish dist/myProject
should be npm publish dist/myProject/
英文:
I just had that issue after migrating to Node 16 & npm 8 :
Per this issue, the publish path needs a trailing slash.
So npm publish dist/myProject
should be npm publish dist/myProject/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论