Created
May 16, 2015 15:02
-
-
Save nicolashery/2d259b6ccca28020533c to your computer and use it in GitHub Desktop.
npm cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# avoid "works on my machine" by always locking dependency versions | |
npm config set save-exact=true | |
# install/uninstall project packages with flags that will update package.json | |
npm install --save lodash | |
npm install --save-dev jshint | |
npm uninstall --save lodash | |
# tool that makes upgrading dependencies easier, install it globally | |
npm install -g david | |
# in a project directory, run: | |
david | |
# it will give give you commands you can copy/paste to update dependencies | |
# sometimes updating doesn't grab latest version | |
# instead of using: | |
npm update -g david | |
# use this: | |
npm install -g david@latest | |
# when working on 2 repos, one depending on the other | |
cd /code/my-dep | |
npm link | |
cd /code/my-app | |
npm link my-dep | |
# asumes "my-dep" is also name in package.json, which is what npm link needs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment