-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm cache does not speed up npm install
#385
Comments
Another question is, what is the point of including However, I would say this is pointless, since if So, what's the point of including |
Hello @ugultopu. Thank you for your report. The action setup-node caches saves cache from the global cache directory. The benefit from the caching comes for medium and large size dependencies. Besides, some dependencies are built in runtime, that is why it takes more time. We use a package-lock.json file, because it contains the exact versions of all dependencies. If some dependencies change the cache can be outdated, that is why we use package-lock.json to track it. Moreover, we use package-lock.json file because it is of the mostly used package's tree dependency file. You can override this behaviour with cache-dependency-path. We have a feature request with adding restore keys to the action. For now I'm going to close the issue, because it's an expected behaviour. If you have any concerns feel free to ping us. |
Hi @dmitry-shibanov ,
this file however cache has been stored in action cache but after i run pipeline it is install dependencies from scratch it gets 1 minute and doesnt use stored cache. |
please can you explain how we can use stored cache for future runs? |
Description:
Consider the following builds:
These two repositories are almost identical, with the only difference being the latter repository caches
npm
via thesetup-node
GitHub Action, whereas the former one does not. In other words, the only difference between the repositories is at the.github/workflows/main
file:Although the build at "setup-node-with-cache" successfully uses npm cache (as evident by the output of the
Run actions/setup-node@v2
step), run time ofRun npm install
step is almost the same as the corresponding step of the build at "setup-node-without-cache".Isn’t the run time of
Run npm install
step of the build at "setup-node-with-cache" supposed to be significantly shorter than the corresponding step of the build at "setup-node-without-cache", since it is supposed to use the cached npm packages? Am I missing something here?Action version:
2
Platform:
Ubuntu
Runner type:
Hosted
Tools version:
Node 11 and default npm that comes with it.
Repro steps:
Expected behavior:
The
npm install
step of the build that uses the cached npm to be quicker.Actual behavior:
The
npm install
step of the build that uses the cached npm is (virtually) the same as the non-cached version.The text was updated successfully, but these errors were encountered: