I’m adding caching to my CI workflow, but I’m having some issues when running npm install
. Basically after I run the install command, it is changing the package-lock.json
file, by adding the package name to the top of the lock file, in the ""
key, which is supposed to be the root package of the repo. That change makes the checksum
of the file to change, which makes the caching to not work properly.
I tried running with SSH, and checking the node and npm versions, and both are on the same as my machine: 12.22.1, and 7.11.0
The exact same circleCI config worked for my other repo, so I’m not sure what is going on here
version: 2.1
orbs:
untracked_changes: niteo/check-untracked-changes@1.0.0
aliases: [
# Lockfile cache key (update "vN" => "vN+1" to cache-bust).
&dependency-cache-key 'v1-dependencies-cache-test3-{{ checksum "package-lock.json" }}',
]
jobs:
install-deps:
docker:
- image: cimg/node:12.22.1
steps:
- checkout
- restore_cache:
keys:
- *dependency-cache-key
# Fallback key https://circleci.com/docs/2.0/caching/#partial-dependency-caching-strategies
- v1-dependencies-cache-test3-
- run:
name: Update npm to 7.11
command: sudo npm install -g npm@7.11.0
- run:
name: Install
command: |
npm set //npm.pkg.github.com/:_authToken=$GITHUB_NPM_READ_TOKEN
npm install
- untracked_changes/check
- save_cache:
key: *dependency-cache-key
paths:
- "node_modules"
workflows:
commit-workflow:
jobs:
- install-deps