I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I'm guessing that it was because the project was running BackstopJS (a visual regression testing tool) and in order to work cross platform, that runs in a docker container. If the npx command was running inside a container that didn't persist, then it would have to download everything every time.
TBH, I wasn't paying enough attention to that side of things to be able to give you an accurate description. I just assumed that it was npx that didn't cache anything!
Ah yeah, a Docker container would have absolutely stripped any benefits there. In that case, you're 100% right that a normal global install would be best.
Ideally, pre-baking that into the image would be the best case scenario... but if they couldn't have done that taking Bryan Hughes advice from his comment on this post and putting it into devDependencies. Combining that with npm ci usage would be great too, since npm ci just reads the predetermined dependencies in the package-lock.json and doesn't take compute time to resolve the dependency structure.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm guessing that it was because the project was running BackstopJS (a visual regression testing tool) and in order to work cross platform, that runs in a docker container. If the
npx
command was running inside a container that didn't persist, then it would have to download everything every time.TBH, I wasn't paying enough attention to that side of things to be able to give you an accurate description. I just assumed that it was
npx
that didn't cache anything!Ah yeah, a Docker container would have absolutely stripped any benefits there. In that case, you're 100% right that a normal global install would be best.
Ideally, pre-baking that into the image would be the best case scenario... but if they couldn't have done that taking Bryan Hughes advice from his comment on this post and putting it into devDependencies. Combining that with
npm ci
usage would be great too, sincenpm ci
just reads the predetermined dependencies in the package-lock.json and doesn't take compute time to resolve the dependency structure.