首页 > 解决方案 > npm install 在 Travis CI 中工作,但在 GitHub Actions 中失败

问题描述

我们正在从迁移Travis CIGitHub Actions. 在Travis CI中,我们为node存储库构建了版本。

Travis CI配置:

dist: trusty
language: node_js
node_js:
  - 6.10.3

使用此配置, InTravis CI正在npm install工作。

GitHub Actions配置:

jobs:
  build:
    runs-on: ubuntu-20.04

    steps:
      - name: Setup Node.js environment
        uses: actions/setup-node@v2.1.5
        with:
          node-version: '6.10.3'

      - name: Check out repository code
        uses: actions/checkout@v2.3.4

      - name: script
        run: |
          npm install

但是在GitHub Actions,我得到以下错误

29484 verbose correctMkdir /github/home/.npm correctMkdir not in flight; initializing
129485 verbose afterAdd /github/home/.npm/bower/1.8.2/package/package.json written
129486 silly rollbackFailedOptional Starting
129487 silly rollbackFailedOptional Finishing
129488 silly runTopLevelLifecycles Finishing
129489 silly install printInstalled
129490 verbose stack Error: ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129490 verbose stack     at Error (native)
129491 verbose cwd /__w/website/website
129492 error Linux 5.4.0-1047-azure
129493 error argv "/__t/node/6.10.3/x64/bin/node" "/__t/node/6.10.3/x64/bin/npm" "i"
129494 error node v6.10.3
129495 error npm  v3.10.10
129496 error path /tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz
129497 error code ENOENT
129498 error errno -2
129499 error syscall open
129500 error enoent ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129501 error enoent ENOENT: no such file or directory, open '/tmp/npm-604-fb46bda8/registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz'
129501 error enoent This is most likely not a problem with npm itself
129501 error enoent and is related to npm not being able to find a file.
129502 verbose exit [ -2, true ]

我尝试了以下步骤,但没有运气。

到目前为止,我正在考虑OS两个 CI 之间的区别。Travis 存在Ubuntu 14.04和 GitHub Actions 存在Ubuntu 20.04(我也尝试过18.04

有人遇到过类似的问题吗?任何解决方法的想法?

如果需要更多信息,请告诉我!

谢谢!

标签: travis-cinpm-installgithub-actions

解决方案


推荐阅读