Guest User

Untitled

a guest
Aug 16th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. mkdir new-project && cd new-project
  2.  
  3. # create package.json file
  4. npm init # use --yes to skip set-up questions
  5.  
  6. #INSTALLING NEW PACKAGES. Note: Creates node_modules folder to hold source code for packages.
  7. # See package.json file after installing new packages.
  8.  
  9. # for non-dev dependencies
  10. npm install package
  11.  
  12. # for dev dependencies
  13. npm install package --save-dev
  14.  
  15. # specify version
  16. npm install package@x.x.x
  17.  
  18. # View dependencies tree (installed packages, plus their dependencies). Includes version metadata
  19. npm list
  20.  
  21. # View only project dependencies
  22. npm list --depth=0
  23.  
  24. # Check if newer package versions available
  25. npm outdated
  26.  
  27. # update packages. Note: npm checks versioning in package.json to make sure updates don't break your app.
  28. # for example, if 6.0.0 was available for mongoose and in package.json mongoose: "dependencies": {
  29. # "mongoose": "^5.2.8",
  30. # "underscore": "^1.9.1"
  31. # then npm would update to latest major 5 version
  32.  
  33. npm update
  34.  
  35. # update to latest version
  36. # first install npm-check-updates globally
  37. npm i -g npm-check-updates
  38.  
  39. # run it
  40. npm-check-updates
  41.  
  42. # or
  43. ncu
  44.  
  45. # then
  46. npm install
  47.  
  48. # uninstalling packages
  49. npm uninstall package
  50.  
  51. # or
  52. npm un package
  53.  
  54. # publish package on npm (requires sign-up). Simple
  55. # open terminal from within project folder
  56.  
  57. npm publish
  58.  
  59. # updating a published package
  60. # terminal in project folder
  61. # choose one from major, minor, or patch. if adding functionality, minor, if bug fix, patch. if change could break, then major
  62.  
  63. npm version major/minor/patch
Add Comment
Please, Sign In to add comment