GitHub操作未能安装NPM并失败验证

发布于 2025-02-08 16:49:39 字数 3823 浏览 0 评论 0 原文

github操作构建脚本

name: Deploy
on:
 push:
   branches: [ "main" ]

jobs:
   build_on_mac:
     runs-on: macos-latest
     steps:
     - uses: actions/checkout@v3
       with:
         persist-credentials: false
     - name: Use HTTP
       run: >
         git config --global url."https://github.com".insteadOf ssh://[email protected]
     - uses: actions/setup-node@v3
       with:
         node-version: 14
     - name: install dependencies
       run: npm install

它一直在随机处理一个特定的软件包。.在10次中工作1次

npm WARN tarball tarball data for buble@git+ssh://[email protected]/pemrouz/buble.git#4e639aeeb64712ac95dc30a52750d1ee4432c9c8 (sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA==) seems to be corrupted. Trying one more time.
7
npm ERR! Verification failed while extracting buble@git+ssh://[email protected]/pemrouz/buble.git#4e639aeeb64712ac95dc30a52750d1ee4432c9c8:
2895
npm ERR! sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA== integrity checksum failed when using sha512: wanted sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA== but got sha512-J+yRnScDV19Vr5+C8D5IJiIN2auC9t54tYpJmeqVxgyIyJQmF95mqBwBXzXKyvIH9aZvY6RlQqtMsQm0gdH7UQ==. (801561 bytes)

2635,

因此问题是,当package-lock.json是本地生成的,

sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA==

但是当通过操作下载时,它的

sha512-J+yRnScDV19Vr5+C8D5IJiIN2auC9t54tYpJmeqVxgyIyJQmF95mqBwBXzXKyvIH9aZvY6RlQqtMsQm0gdH7UQ==

解决方法是替换github的sha带有预期的一个,允许构建可以完成但显然是错误的。

因此,我可以认为

  • 有人可以告诉我如何永久添加此软件包,以便GitHub不需要安装它
  • 或如何安装 它解决此问题?它似乎不想服用https://并服用ssh:// 。不确定如果

选项替换包裹锁

使用该

name: Release
on:
  release:
    types:
      - created

jobs:
  publish_on_mac:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v3
      with:
         persist-credentials: false
    - name: HTTPS
      run: >
         git config --global url."https://github.com".insteadOf ssh://[email protected]
    - uses: actions/setup-node@v3
      with:
        node-version: 14
    - name: install dependencies
      run: npm install
    - name: publish
      run: npm run publish

npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/pemrouz/buble.git
1226
npm ERR! 
1227
npm ERR! Warning: Permanently added the ECDSA host key for IP address '140.xxx.xxx.xxx' to the list of known hosts.
1228
npm ERR! [email protected]: Permission denied (publickey).
1229
npm ERR! fatal: Could not read from remote repository.
1230
npm ERR! 
1231
npm ERR! Please make sure you have the correct access rights
1232
npm ERR! and the repository exists.
1233
npm ERR! 
1234
npm ERR! exited with error code: 128 

Github Actions build script

name: Deploy
on:
 push:
   branches: [ "main" ]

jobs:
   build_on_mac:
     runs-on: macos-latest
     steps:
     - uses: actions/checkout@v3
       with:
         persist-credentials: false
     - name: Use HTTP
       run: >
         git config --global url."https://github.com".insteadOf ssh://[email protected]
     - uses: actions/setup-node@v3
       with:
         node-version: 14
     - name: install dependencies
       run: npm install

It keeps falling for a particular package randomly.. worked 1 out of 10 times

npm WARN tarball tarball data for buble@git+ssh://[email protected]/pemrouz/buble.git#4e639aeeb64712ac95dc30a52750d1ee4432c9c8 (sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA==) seems to be corrupted. Trying one more time.
7
npm ERR! Verification failed while extracting buble@git+ssh://[email protected]/pemrouz/buble.git#4e639aeeb64712ac95dc30a52750d1ee4432c9c8:
2895
npm ERR! sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA== integrity checksum failed when using sha512: wanted sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA== but got sha512-J+yRnScDV19Vr5+C8D5IJiIN2auC9t54tYpJmeqVxgyIyJQmF95mqBwBXzXKyvIH9aZvY6RlQqtMsQm0gdH7UQ==. (801561 bytes)

2635

So the problem is that when package-lock.json is generated locally it has

sha512-vBjSU8v5gODqXVUvlpgEzjtSMXz2Am8Yh7O1PUZmx6DAzKWT1CrYm5azoYhAGLCWOlkd4aN6LEOCZ+dgVt2rFA==

But when getting downloaded by actions it is

sha512-J+yRnScDV19Vr5+C8D5IJiIN2auC9t54tYpJmeqVxgyIyJQmF95mqBwBXzXKyvIH9aZvY6RlQqtMsQm0gdH7UQ==

Workaround is to replace the SHA in GitHub with expected one which allows build to complete but obviously that looks wrong..

So options I can think are

  • Can someone please tell me how to add this package permanently into build so that GitHub doesn't need to install it
  • Or how to fix this issue? It doesn't seem to want to take https:// and takes ssh://[email protected] . Not sure if that is causing anything

Also if I use the option to replace the SHA in package-lock.json then the publish fails with another error

Publish Action

name: Release
on:
  release:
    types:
      - created

jobs:
  publish_on_mac:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v3
      with:
         persist-credentials: false
    - name: HTTPS
      run: >
         git config --global url."https://github.com".insteadOf ssh://[email protected]
    - uses: actions/setup-node@v3
      with:
        node-version: 14
    - name: install dependencies
      run: npm install
    - name: publish
      run: npm run publish

Error

npm ERR! /usr/local/bin/git ls-remote -h -t ssh://[email protected]/pemrouz/buble.git
1226
npm ERR! 
1227
npm ERR! Warning: Permanently added the ECDSA host key for IP address '140.xxx.xxx.xxx' to the list of known hosts.
1228
npm ERR! [email protected]: Permission denied (publickey).
1229
npm ERR! fatal: Could not read from remote repository.
1230
npm ERR! 
1231
npm ERR! Please make sure you have the correct access rights
1232
npm ERR! and the repository exists.
1233
npm ERR! 
1234
npm ERR! exited with error code: 128 
  • How do we fix this as well?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文