npm install in GitHub Action fails with “ENOENT: no such file or directory” - Works fine elsewhere

我是研究僧i 提交于 2021-02-08 13:29:14

问题


I am currently working on replacing our Drone CI installation with GitHub Actions.

The Action Workflow I have so far boils down to the following .github/workflows/ci.yml file:

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

The log itself comes out as a long series of npm WARN tar ENOENT: no such file or directory ala the truncated list below.

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'

The advice I have found online is to rm package-lock.json but that's not an acceptable solution as I need to test our code with the exact versions of our dependencies we have locked.

Further, I don't believe there is anything wrong with our package-lock.json file to begin with because it still npm install 's as expected both locally and on our Drone CI installation.

来源:https://stackoverflow.com/questions/61512114/npm-install-in-github-action-fails-with-enoent-no-such-file-or-directory-wo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!