GitHub Enterprise 中的 GitHub 操作在 npm 包上提供 401 和 404

2024-02-03

我在用语义版本动作 https://github.com/cycjimmy/semantic-release-action在我的 GitHub 企业存储库上。直到最近它工作得很好,但开始失败这个错误 https://github.com/cycjimmy/semantic-release-action/issues/78

Error: Command failed: npm ci --only=prod
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-23T10_41_00_344Z-debug.log

    at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'npm ci --only=prod',
  stdout: '',
  stderr: 'npm ERR! code E401\n' +
    'npm ERR! Unable to authenticate, need: Basic realm="GitHub Package Registry"\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     /root/.npm/_logs/2021-08-23T10_41_00_344Z-debug.log\n'

我使用的操作预计不会向 GitHub 包注册表发布任何内容,可能只会从包注册表中读取。所以在谷歌搜索之后我在 SO 和其他地方找到了这个 -https://stackoverflow.com/a/63243950/1182982 https://stackoverflow.com/a/63243950/1182982

所以我更新了我的操作,现在看起来像这样(我添加了步骤:设置节点,它以前不存在)

#===============================================================================
#===========================      Semamtic Version    ==========================
#===============================================================================
    semver:
        name: Semantic Versioning
        runs-on: [self-hosted, linux, x64]
        steps:
        - name: Setup node
          run: |
            echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUBCOM_TOKEN }}" >> ~/.npmrc
            echo "@yrshaikh:registry=https://npm.pkg.github.com" >> ~/.npmrc
            echo 'registry "https://registry.yarnpkg.com"' >> ~/.yarnrc
        - uses: actions/checkout@v2
        - name: Semantic Release
          id: semantic
          # https://github.com/cycjimmy/semantic-release-action
          uses: internal-front-end/semantic-release-action@v2
        outputs:
          new_release_published: ${{ steps.semantic.outputs.new_release_published }}
          new_release_version: ${{ steps.semantic.outputs.new_release_version }}

注意,GITHUBCOM_TOKEN我使用我的 github.com 个人资料创建(并授予读取包/存储库访问权限)并且OWNER_NAME in @yrshaikh:registry=https://npm.pkg.github.com我已经填写了 github.com 用户 ID。

完成这些更改后,401 身份验证错误消失了。

但我看到了一个不同的错误,我无法解决该错误 -

Error: Command failed: npm --loglevel error ci --only=prod
npm ERR! code E404
npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@actions%2fcore - npm package "core" does not exist under owner "actions"
npm ERR! 404 
npm ERR! 404  '@actions/[email protected] /cdn-cgi/l/email-protection' 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 ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-08-25T05_40_28_115Z-debug.log

    at ChildProcess.exithandler (child_process.js:295:12)
    at ChildProcess.emit (events.js:210:5)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'npm --loglevel error ci --only=prod',
  stdout: '',
  stderr: 'npm ERR! code E404\n' +
    'npm ERR! 404 Not Found - GET https://npm.pkg.github.com/@actions%2fcore - npm package "core" does not exist under owner "actions"\n' +
    'npm ERR! 404 \n' +
    "npm ERR! 404  '@actions/[email protected] /cdn-cgi/l/email-protection' is not in the npm registry.\n" +
    'npm ERR! 404 You should bug the author to publish it (or use the name yourself!)\n' +
    'npm ERR! 404 \n' +
    'npm ERR! 404 Note that you can also install from a\n' +
    'npm ERR! 404 tarball, folder, http url, or git url.\n' +
    '\n' +
    'npm ERR! A complete log of this run can be found in:\n' +
    'npm ERR!     /root/.npm/_logs/2021-08-25T05_40_28_115Z-debug.log\n'
}

任何帮助或指导将不胜感激。


看起来并没有什么不妥的地方~/.npmrc:

@${OWNER}:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=${TOKEN}

您是否尝试过重新生成该个人访问令牌?请注意,这些机密也有范围,因此它们可能会在私有存储库中解析,但不一定是公共存储库。

$GITHUB_TOKEN可能没有足够的权限 https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token;尝试添加一个个人访问令牌 https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token反而。

什么是npm login --scope=@yrshaikh --registry=https://npm.pkg.github.com give?

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

GitHub Enterprise 中的 GitHub 操作在 npm 包上提供 401 和 404 的相关文章

随机推荐

  • 如何在记事本++中为每一行添加右大括号

    我有一个用记事本打开的文件 显示如下 insert into agent sales values 61 39858 insert into agent sales values 101 5786 insert into agent sal
  • QT:从资源 QSS 文件中 setStyleSheet?

    在我的小部件中 我可以做类似的事情 MyWindow MyWindow QWidget parent QWidget parent ui setupUi this setStyleSheet QWidget background color
  • 使用pyqt4在python中的QLabel上进行可点击事件?

    我正在使用 pyqt4 库和带有信号和插槽的新库在 python GUI 中工作 我不知道如何将事件放在标签名称上QPLabel 这是我的代码 class Ui Form object def setupUi self Form Form
  • 使用 qt:如何在控制台应用程序之上构建 GUI?

    我有一个从 bison 解析器 生成的控制台应用程序 我想为其构建一个简单的 GUI 这样我就可以将此 gui 的输入发送到控制台 并将控制台的输出获取到 gui 中 我尝试使用 java process 类来做到这一点 但它对我不起作用
  • 多对多实体属性的 Hibernate 标准

    Entity class A ManyToMany private List b list Entity class B 我想使用条件 而不是 sql 查询 从 A 类获取列表 可以这样做吗 在这种情况下投影不起作用 不幸的是 标准只允许选
  • 是否可以在单元测试期间禁用Spring的@Async?

    我有一个方法注释为 Async say Async public void makeFood 但我只是想测试该方法的逻辑 可以同步测试吗 是的 只要你的配置没有 EnableAsync 该方法将同步执行
  • 网页视图无法滚动

    我有这个 Xamarin 表单页面
  • 调用 Time.In 时缺少位置

    当我使用beego orm操作postgresql数据库时 出现这样的错误 调用Time In时缺少位置 代码示例 type dataTest struct Id int pk auto Data time Time orm auto no
  • CodeIgniter + WordPress 集成

    我的网站是用 WordPress 设计的 一些主题页面有一个用于预订的定制 PHP 脚本 我想在 CodeIgniter 中重构它 以获得更大的灵活性 问题 1 如何通过CI的路由系统使用WP中的CI功能 我是否必须制作一个 CI 页面 i
  • 为什么 Swift 中的公共类/结构需要显式公共初始值设定项?

    考虑模块中的以下类 也同样适用于结构体 public class Foo public func bar method body 注意 它没有显式的初始化器 这个例子不需要任何特殊的初始化 该类将暴露给其他模块 因为它被标记为public
  • 删除匹配字符之后的所有字符

    我有一个包含很多行的文件 http example com part 1 this number 1 one http example com part 2 this is number 21 two http example com pa
  • 使用gRPC共享非常大的文件

    我想使用 gRPC 在端点和服务器之间共享非常大的文件 超过 6GB 我当前工作的项目需要一个中央服务器 端点可以在其中上传和下载文件 限制之一是端点彼此不认识 但它们可以从公共总线相互接收和发送消息 为了实现该服务器及其与端点的通信 我正
  • 如何从mongodb中检索数据并显示在ejs页面中?

    我已经向 mongodb 添加了数据 我正在使用猫鼬 我想从 mongodb 数据库获取数据并将其显示在 ejs 页面中 我在互联网上搜索了很多 但在尝试这些时遇到错误 我不明白错误是什么 这是我最近尝试过的 猫鼬模式 var mongoo
  • 在seaborn中绘制多个箱线图

    我想在 pandas 中使用 seaborn 绘制箱线图 因为这是一种更好的可视化数据的方式 但我不太熟悉它 我有三个不同指标的数据帧 我想比较不同的指标 我将循环遍历文件路径来访问它们 for path in paths df pd re
  • 参数数量未知的 C++ 函数指针

    我需要一些关于 C 的帮助 拜托 我正在为一个基于文本的小型游戏编写命令解析器 但遇到了一些问题 解析器应该读取并解析玩家输入的命令 最明显 最直接的解决方案可能是这样的 用伪代码编写 command lt read input from
  • Emacs:组织模式电子表格:通过 hline 定位

    我正在尝试在组织模式下记录我的时间 Bob Johnson Bob s SEO subject time minutes total hours optimization report 2011 07 11 8 10 00 PM PST 1
  • 如何编译适用于 Windows 的 Prometheus UI 静态二进制文件?

    我在尝试着从 Windows 上的 Grafana 访问 GCP 托管 Prometheus 指标 https stackoverflow com q 74563137 20592222 为此我需要为 Prometheus UI 前端编译一
  • 为高度倾斜的数据生成直方图

    我在用着dc js crossfilter js and d3 js生成条形图 条形图表示信用卡交易的数据 它绘制了交易数量 y 轴 与交易金额 x 轴 的关系 它看起来像这样 数据数组基本上如下所示 txn id 1 txn amount
  • WMI 与 Windows API

    使用该方法有任何优点或缺点WMI http msdn microsoft com en us library aa394582 28VS 85 29 aspx代替视窗应用程序接口 http msdn microsoft com en us
  • GitHub Enterprise 中的 GitHub 操作在 npm 包上提供 401 和 404

    我在用语义版本动作 https github com cycjimmy semantic release action在我的 GitHub 企业存储库上 直到最近它工作得很好 但开始失败这个错误 https github com cycji