我目前正在使用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
的形式出现在下面的截断列表中。
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安装所期望的那样。
4条答案
按热度按时间gywdnpxw1#
在漫长的等待中,我找到了解决方案:
使用GitHub Actions从私有GitHub存储库安装npm模块
字符串
我自己基本上都试过了,但最重要的部分却没有:
型
默认情况下,
actions/checkout@v2
会扰乱Git的一些设置,并阻止insteadOf
正常工作。zzoitvuj2#
如果您使用的是私有npm包,并且忘记将secret添加到repo中,也会发生这种错误情况。
例如,如果你在GitHub Actions工作流中有这样的东西:
字符串
.如果
$ACME_CORP_TOKEN
不存在,像上面这样的操作不会失败(尽管这样做会更好),所以如果你忘记了实际添加ACME_CORP_TOKEN
秘密到存储库(在存储库设置的Secrets选项卡中),那么你会遇到同样的问题。node_modules
内部的普通依赖项的npm WARN tar ENOENT
错误的巨大列表不会使问题实际上是缺少私有注册表访问令牌变得明显。iklwldmw3#
我们有这个问题。在无休止的
tar ENOENT
错误流中,我们发现了另一个错误(为简洁起见编辑):字符串
在我们的例子中,有问题的存储库是公共的,但是无论出于什么原因,
npm
仍然试图通过ssh而不是https获取它(不像我们所有其他的依赖项)。我们通过在工作流中添加一个额外的步骤来解决这个问题,将
npm
配置为使用https:型
mrwjdhj34#
在我的例子中,其中一个文件已从Pascal大小写重命名为小写:
首页.vue =>首页
由于未知原因,此更改尚未复制到GitHub存储库。(我以前在Windows系统上见过这种情况,但在我的Mac上没有)。我的解决方案是重命名该文件和对它的相应引用:
首页.vue =>首页.vue