gpt4 book ai didi

node.js - GitHub Action 中的 npm install 失败并显示 "ENOENT: no such file or directory"- 在其他地方工作正常

转载 作者:行者123 更新时间:2023-12-03 12:10:38 30 4
gpt4 key购买 nike

我目前正在用 GitHub Actions 替换我们的 Drone CI 安装。

到目前为止,我的操作工作流程归结为以下 .github/workflows/ci.yml文件:

on: [ push, pull_request ]

name: CI
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '13.x'

- name: Install Dependencies
run: npm install

日志本身是一长串 npm WARN tar ENOENT: no such file or directory ala 下面的截断列表。
2020-04-29T21:15:31.7899082Z npm install
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/acorn-26d8ba97/dist/acorn.js.map'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/coffeescript-acee515b/lib/coffee-script/register.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/coffeescript-acee515b/lib/coffee-script/repl.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/coffeescript-acee515b/lib/coffee-script/rewriter.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/tslint-c216b578/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/eslint-cd3dbe58/LICENSE'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/eslint-cd3dbe58/README.md'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/typescript-b4b55d18/lib/diagnosticMessages.generated.json'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/jquery-1794793b/dist/jquery.min.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/lodash-05c1df31/fp/_convertBrowser.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/lodash-70e4a396/fp/_convertBrowser.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/lodash-79f5ae17/fp/_convertBrowser.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/lodash-e49b02f6/fp/_convertBrowser.js'
npm WARN tar ENOENT: no such file or directory, open '/home/runner/work/project/project/node_modules/.staging/lodash-16fa050d/fp/_convertBrowser.js'

我在网上找到的建议是 rm package-lock.json但这不是一个可接受的解决方案,因为我需要使用我们锁定的依赖项的确切版本来测试我们的代码。

此外,我不认为我们的 package-lock.json 文件有任何问题,因为它仍然 npm install在本地和我们的 Drone CI 安装上都符合预期。

最佳答案

经过漫长的等待,我在这里找到了解决方案:
Install an npm module from a private GitHub repository using GitHub Actions

      - uses: actions/checkout@v2
with:
persist-credentials: false
- uses: actions/setup-node@v1
with:
node-version: 12.x
- run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/
- run: npm ci
...
我基本上自己尝试了所有这些,但最重要的部分丢失了:
        with:
persist-credentials: false
actions/checkout@v2默认情况下会搞乱 Git 的一些设置并阻止 insteadOf从正常工作。

关于node.js - GitHub Action 中的 npm install 失败并显示 "ENOENT: no such file or directory"- 在其他地方工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61512114/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com