Npm install is taking 10+ minutes to finish

Hey there.
I have been using github actions for all my tests.
npm install step only took 1 minute last week, but these couple days it took 10+ minutes to just install. Any one experience the same issue?

4 Likes

same here, npm install or ci takes > 5 min, where it took normally 30 sec.
Any idea on the issue

After some digging around, it appears NPM uses the old and discontinued git:// protocol. See https://github.blog/2021-09-01-improving-git-protocol-security-github/.

The fix we are using is:

git config --global url."git@github.com:".insteadOf git://github.com/

This will tell git to use ssh instead of the old git:// protocol. Hope this can help others.
If there is an even better solution, I would love to hear about it!

4 Likes

Thanks @timbeks How do you set it? It there a global way to set it? I don’t want to add it at each step of my workflows

Hi @BioCarmen ,

We’ve put that command within our base images. I don’t know how to resolve this with Github Actions.

Hopefully you can do the same.

1 Like

The most direct approach would be stick it as a step just before your npm install step. Or as part of the NPM install step like so: git config --global url."git@github.com:".insteadOf git://github.com/ && npm install. No need for adding it to every step, just the npm install.

You could alternatively set up a customized build container with any specialized configuration or tools pre-installed and then run the job in that. I’ve found this method very helpful in smoothing out and speeding up workflows that are dependency heavy (package deps, custom config, custom security stuff).

1 Like