This is the issue that I have facing when running the command npm ci to install dependencies in my GitHub Action file. I am working on an some app and using GitHub Actions as a CI for triggering builds whenever I push my code to developmemt branch. After a lot of research, I was able to figure out that this happens when I’m not using npm install for installing dependencies. In my case, I was only using npm for the dependencies so I was only having package-lock.json file and no package-lock.json file. One way to resolve this was using npm install to install the dependencies, then I have a package-json.lock file and CI won’t throw any error.

- name: Install dependencies
        run: |
          if [ -e package-lock.json ]; then
          npm install --frozen-lockfile
          elif [ -e package-json.lock ]; then
            npm ci
          else
            npm i
          fi

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee