Package Managers
Node.js
- Cross-platform environment that runs JavaScript outside of web browser
- Allows developers to use JavaScript to write CLIs and server-side scripts
- Useful for back end driven web pages
npm
- Package manager for JavaScript programming
- Default package manager for Node.js
- Provides following services:
- Command line client (also called npm)
- Online database of public/private packages
- Packages are accessed via CLI, and can be browsed on npm website
- Packages are written in JS modules
- Requires usage of
import and expoert statements
- Uses
package-json.lock version lock file
Yarn
- Alternative to npm
- Differences from npm
- Installation
- Yarn installs packages in parallel, while npm installs one package at a time
- Dependency management
- Yarn uses Plug’n’Play which uses map file that maps project dependencies instead of using node modules folder
- More streamlined dependency of trees
- Quicker project launch and installation
- Offline caching
- Both npm and Yarn allow for saving files to offline cache
- Yarn uses Zero Installation
- Leverages dependency map for installation of offline dependencies with zero delays
- Faster performance, and allows for offline capabilities
- Security
- Yarn uses checksum for ensuring data integrity, while npm uses SHA-512 to check data integrity of the packages downloaded
- License checking when obtaining installation packages
- Yarn binds versions of the package strongly
- Uses
yarn.lock version lock file
pnpm (performant npm)