Npm tips and tricks

From HPCWIKI
Revision as of 08:13, 2 May 2023 by Admin (talk | contribs) (Created page with "== $npm install vs $ npm ci <ref>https://www.ariank.dev/be-aware-of-the-package-lock-json-and-npm-install/</ref> == the difference between <code>npm install</code> and <code>npm ci</code>, it is worth explaining it. <code>npm install</code> will generate a new <code>package-lock.json</code> if it does not exist or it will update the dependency tree if it does not match the packages specified in the <code>package.json</code>. <code>npm ci</code> will install packages base...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

$npm install vs $ npm ci [1]

the difference between npm install and npm ci, it is worth explaining it. npm install will generate a new package-lock.json if it does not exist or it will update the dependency tree if it does not match the packages specified in the package.json. npm ci will install packages based on package-lock.json file and if the file does not exist or does not match the packages specified in the package.json it will throw an error and fail.

Note it is better to use npm ci if you are not going to add new packages or update the package version to keep the development consistent with other team members.

Reference