Node Package Manager(npm) is a package management tool for NodeJS packages. Yarn is a newer, faster tool that does the same thing. NPM and Yarn are both installed in the drupal
container.
NodeJS packages are configured through package.json
. Documentation for package.json
is available here, but keep in mind that you are using NPM to manage dependencies, not to publish packages to NPM, so several features do not apply to your project (eg: the files
section).
Use yarn
rather than npm
- these two commands are equivalent, but yarn
is faster, and the CircleCI build relies on a yarn.lock
file that gets generated when you use yarn
.
- Install all dependencies:
yarn install
- Update dependencies to the latest versions:
yarn upgrade
- List outdated dependencies:
yarn outdated
- Add a new dependency:
yarn add mypackage
. This will add the package topackage.json
and install it right away.