Using `npm ci` vs `npm install`

I am trying to figure out what CircleCI recommends when installing dependencies in a javascript project?

npm install or npm ci?

I know there already is this thread, but it was locked down on september 30, 2018 (and does not really conclude anything :man_shrugging:t2:). Since NPM seems to really push the ci command, I think it would be awesome to establish some consensus on how we achive the fastets configuration :racing_car:

2 Likes

Hi there,

Welcome to our community!

This is the first I heard about npm ci but it looks amazing. I am curious if anyone here has tried this in their own projects on CircleCI and what that experience has been like.

1 Like

I highly recommend npm ci. Otherwise, npm might update your dependencies between re-runs of the same CI build.

Here is an example configuration file: https://github.com/juanca/react-aria-components/blob/c48abf1f9b3cde0485ad328d2b478107402ba804/.circleci/config.yml#L34

1 Like