TIL: GitHub Actions | Fix "Error: Dependencies lock file is not found"
Sardorbek Imomaliev
Posted on February 14, 2022
Question
How to fix this error:
Error: Dependencies lock file is not found in /path/to/project. Supported file patterns: package-lock.json,yarn.lock
in actions/setup-node@v2
GitHub Action?
Answer
This error occurs because by default, this job searches for package-lock.json
in the root of the repository for caching. We need to explicitly specify the location of our package-lock.json
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.14.0
cache: "npm"
+ # The action defaults to search for the dependency file
+ # (package-lock.json or yarn.lock) in the repository root, and uses
+ # its hash as a part of the cache key.
+ # https://github.com/actions/setup-node#caching-packages-dependencies
+ cache-dependency-path: "./blog/package-lock.json"
Links
💖 💪 🙅 🚩
Sardorbek Imomaliev
Posted on February 14, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
githubactions TIL: GitHub Actions | Fix "Error: Dependencies lock file is not found"
February 14, 2022