Nodejs binary is not cached
See original GitHub issueDescription:
The nodejs binary is not cached, setup-node
downloads it from https://github.com/actions/node-versions/releases
on every run.
Action version: Latest
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version: node 16.15.1
Repro steps:
- name: "Set up nodejs"
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
In a composite action.
Expected behavior: Nodejs binary should be pulled from the cache, not downloaded every time.
Actual behavior: Logs showing the issue:
Resolved .nvmrc as 16.15.1
Attempting to download 16.15.1...
Acquiring 16.15.1 - x64 from https://github.com/actions/node-versions/releases/download/16.15.1-2426430333/node-16.15.1-linux-x64.tar.gz
Extracting ...
/usr/bin/tar xz --strip 1 --warning=no-unknown-keyword -C /home/runner/work/_temp/fa1f695b-6acd-4867-b040-2ef9482f9b49 -f /home/runner/work/_temp/1f3d7c09-4341-4773-9225-73d14d319922
Adding to the cache ...
Done
In the logs above we see “Adding to the cache …”, but on a subsequent run the same happens (.i.e. nodejs is downloaded from node-versions/releases
). This means that a subsequent runs also shows “Attempting to download 16.15.1…” although the binary should come from the cache this time.
I also tried to set the nodejs version directly (without a file), same issue.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
node.js - npm install force to not use binary cache and rebuild ...
I want to reproduce the error by forcing node to rebuild those packages, but I've not been able to. I tried this command:...
Read more >The compiled binary should be also cached. #1882 - GitHub
I find the compiled binary not be cached in ~/.npm/node-sass . So If the node-modules/ dir removed will download or compile again.
Read more >Nodejs cache images or other binary data on local disk ...
I've been looking for a simple npm package that will allow caching arbitrary binary data (images, specifically) on a local fs storage.
Read more >Caching In Node.js Applications - Honeybadger Developer Blog
Caching is a common technique for making your applications faster. It lets you avoid slow operations by reusing previous results.
Read more >cache-manager-fs-binary - npm package - Snyk
The npm package cache-manager-fs-binary was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry I switched tabs and read the wrong repo name! Ignore my last message.
I think there should be a simple improvement that checks
downloadPath
to see if there’s already a matching binary there, that way we can use other caching actions to leverage this. Should be simple enough rightHello everyone. Hosted images have preinstalled versions of Nodejs in hosted toolcache directory, the action can utilize them. According to documentation the action caches global package dependencies. The action does not cache
node_modules
.When the job is finished the hosted runners get cleaned to the initial state that is why the Nodejs will be installing for next jobs.
For now I’m going to close the issue because it’s an expected behaviour.