As an Angular developer npm install is a well known command. Copying this command to your Continuous Integration pipeline is a bad idea. Use the npm ci command instead. Here is why.
We will concentrate on the differences betwee install and ci. For the complete overview of this command look at the documentation.
The intention of this command is for any situation where you want to make sure you’re doing a clean install of your dependencies. It can be significantly faster than a regular npm install by skipping certain user-oriented features. It is also more strict than a regular install, which can help catch errors or inconsistencies caused by the incrementally-installed local environments of most npm users.
Npm install reads package.json for the dependencies and informs package-lock.json for the right versions. Missing dependencies/version will be added to the package-lock.json.
Npm ci installs dependencies directly from package-lock.json and only uses package.json to validate for mismatches (an exception is throw on violation). Moreover ci does not write to any of these files.
Npm install will install only missing node modules.
Npm ci will delete any existing node modules before beginning the installation.
Hopefully you understand the differences between npm install and npm ci so you can use the best one for your use case. Happy npm’ing!