We are experiencing slow execution times for the npm install command on our self-hosted GitHub runners in AWS Cloud. Here is our setup:
Infrastructure: We use terraform-aws-github-runner module and Packer images.
Environment:
Issue:
The npm install command runs extremely slow on our self-hosted GitHub runners. For instance, it takes around 5 minutes compared to 1 minute on GitHub-hosted runners. The process spends most of its time extracting packages from tgz files in npm cache.
Troubleshooting Steps Taken:
Any advice?
After much debugging we established the cause of the problem. In the packer script, github runner is configured to run as scheduled task. See script here. If we run it as windows service under NETWORK_SERVICE credentials - it installs npm modules much faster. I will post fixed code as soon as we find suitable solution for this code.