Use Dependency Cache for npm install (node_modules)
Hi there,
thanks for this addons. It works so well.
I have one little enhancement I'd love to have. Currently I build a lot of stuff with npm. I speed up my builds (without bamboo) with the following trick:
- if exists: copy node_modules from a previous build to the current build directory
- run npm install as before
this speeds up the tasks that have to build from source enormously. Npm will update the versions that are new in the package.json A more stable algorithm would be to store the dependencies in a cache where the cache-key is build from the package.json. But thats enhc.
I would love to see this option in the npm task.
Best regards Philipp
Comments (4)
-
-
If you don't tell bamboo to clean up the build environment after every build, your node_modules will be preserved across builds. Is that not happening?
-
That's true, I've checked it. Unless you select "Force Clean Build" in your "Source Code Checkout" task configuration, Bamboo will preserve the build directory contents. Which means that node_modules should also be preserved.
Please double-check if npm install actually does download all the dependencies again. You can look for it in the build log - go to build result and view the logs. The first build should contain a lot of downloads, but the second should not.
If this actually happens (node_modules is not preserved between builds), then you should probably raise a bug or support ticket for Bamboo.
I'm closing this ticket as it is not Node.js Plugin related.
-
- changed status to resolved
- Log in to comment
Can you give an example of the code you used for copying the node modules. I would also be interested in speeding up my npm install.