Monday, March 26, 2018

Package manager tips

Initially I was just going to post about how to install npm packages while offline, but in case I ever come back to update this page with more tips or package manages, this post is now titled "Package manager tips".

npm tips

  1. Configure initial values for npm init -y
    • npm config set init.author.name YOUR_NAME
    • npm config set init.author.email YOUR_EMAIL
    • npm config set init.license UNLICENSED
  2. Installing a package offline:
    • versions older than npm 5, use the local-npm package
    • npm install --prefer-offline
  3. Update a package, e.g. Angular CLI
    • npm uninstall -g @angular/cli
    • npm cache verify # if npm < 5, npm cache clean
    • npm install -g @angular/cli@latest
  4. View the versions of a package:
    • npm view webpack version --json
    • npm view webpack versions --json

yarn tips

  1. Configure initial values for yarn init -y
    • yarn config set init-author-name YOUR_NAME
    • yarn config set init-author-email YOUR_EMAIL
    • yarn config set init-license UNLICENSED