How to view the dependency tree of a given npm module?

You can generate NPM dependency trees without the need of installing a dependency by using the command npm list This will generate a dependency tree for the project at the current directory and print it to the console. You can get the dependency tree of a specific dependency like so: npm list [dependency] You can … Read more

What is the role of the package-lock.json?

It stores an exact, versioned dependency tree rather than using starred versioning like package.json itself (e.g. 1.0.*). This means you can guarantee the dependencies for other developers or prod releases, etc. It also has a mechanism to lock the tree but generally will regenerate if package.json changes. From the npm docs: package-lock.json is automatically generated … Read more

What is the difference between “npm install” and “npm ci”?

From the official documentation for npm ci: In short, the main differences between using npm install and npm ci are: The project must have an existing package-lock.json or npm-shrinkwrap.json. If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock. npm … Read more

tech