Closed
Description
Description:
When caching npm dependencies, initial cache never gets created.
Action version:
v3
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version:
Run actions/setup-node@v3
Attempting to download 20.4.0...
Acquiring 20.4.0 - x64
Repro steps:
I have setup-node configured with npm cache:
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: ${{ env.nodejs_version }}
cache: 'npm'
cache-dependency-path: ${{ env.repo_dir }}/package-lock.json
- name: Install NodeJS modules
run: |
cd $repo_dir && npm ci
When workflow runs, setup-node sees there is no cache:
Run actions/setup-node@v3
Attempting to download 20.4.0...
Acquiring 20.4.0 - x64 from https://github.com/actions/node-versions/releases/download/20.4.0-5484146983/node-20.4.0-linux-x64.tar.gz
Extracting ...
/usr/bin/tar xz --strip 1 --warning=no-unknown-keyword -C /home/runner/work/_temp/48b89860-06fe-4719-88d8-9b348eae167b -f /home/runner/work/_temp/9cc686a7-e143-4ead-85e4-ecfcab256528
Adding to the cache ...
Environment details
/opt/hostedtoolcache/node/20.4.0/x64/bin/npm config get cache
/home/runner/.npm
npm cache is not found
Install of packages completes:
Run cd $repo_dir && npm ci
(node:1860) [DEP0170] DeprecationWarning: The URL git+ssh://git@github.com-id_rsa_file:mjgs/file#7c95d46d827416d4dd377e14fbeda5430cec26cc is invalid. Future versions of Node.js will throw an error.
(Use `node --trace-deprecation ...` to show where the warning was created)
added 205 packages, and audited 206 packages in 3m
However looking at Actions page Caches tab afterwards, no cache got created. Same thing happens on re-running the workflow.
Expected behavior:
I expected a cache entry to get created on Actions page Caches tab, and for that to get restored on subsequent runs.
Actual behavior:
No cache ever gets created. How do I create the initial cache?