- Installing a package
npm i pkg npm install pkg
- Installing a package globally
npm i -g pkg npm install --global pkg
- Installing a package and save it as a dependency
npm i -S pkg npm i --save pkg
- Installing a package and save it as a dependency
npm i -D pkg npm i --save-dev pkg
- Initializing a new package
npm init --yes
npm init -y
npm init -f
- Running tests
npm test npm t
- List Available Scripts
npm run list of all available scripts
- (Optional) Install ntl
npm i -g ntl ntl [allows to run the scripts]
- List installed packages (all dependencies)
npm ls --depth 0
- List all globally installed packages
npm ls -g --depth 0
- Ensure clean install of dependencies
npm ci
ornpm clean-install
- Copied from This FreeCodeCamp Medium article
- Opening a package’s homepage
npm home $package
- e.g.
npm home lodash
- Opening a package's repository
npm repo $package
- e.g.
npm repo lodash
- Check packages that are not declared in package.json
npm prune
- Bump a package version (minor, major, patch)
npm version $patch/$minor/$major v $version
- patch example:
npm version patch v 1.0.1
- minor example:
npm version minor v 1.1.1
- major example:
npm version major v 2.0.0
- Install a package without affecting package.json file
npm i package --no-save
- Generate table of installed and latest versions of packages
npm outdated
Last active
May 20, 2019 21:51
-
-
Save AdamMescher/0af5606507f697355847ed5a406642dc to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment