Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WTF is NPM?

Lucas Hrabovsky
September 14, 2012

WTF is NPM?

Quick in office talk to answer questions about NPM

Lucas Hrabovsky

September 14, 2012
Tweet

More Decks by Lucas Hrabovsky

Other Decks in Technology

Transcript

  1. WTF is NPM? And how do I get surgical with

    it? Friday, September 14, 12
  2. Node Package Manager Homebrew / PIP for Node.js Command line

    tool npm CouchDB registry npmjs.org Friday, September 14, 12
  3. The Registry • Think PyPi • Central repository of meta

    and source • CouchDB: easily run your own Friday, September 14, 12
  4. Two Installation Modes Install globally npm install -g <module> Install

    locally npm install <module> real virtualenv! Friday, September 14, 12
  5. package.json { "name": "plata", "description": "A client interface to various

    AWS services.", "version": "0.0.1", "repository": { "type": "git", "url": "git://github.com/exfm/node-plata.git" }, "author": "Lucas Hrabovsky <[email protected]>", "main": "index.js", "directories": { "lib": "lib" }, "engines": { "node": ">= 0.6.0" }, "dependencies": { "libxmljs": ">= 0.4.0", "when": "1.3.0", "winston": "0.6.1", "whet.extend": "0.9.7" } } module name / description where people can see source other modules that should be installed when your module is installed http://package.json.jit.su/ Cheat Sheet Friday, September 14, 12
  6. Developing Packages npm update 1. Search the registry for new

    versions of all the packages installed. 2. If there's a newer version, then install it. 3. Point dependent packages at the new version, if it satisfies their dependency. 4. Remove the old versions, if no other package names them as a dependency. http://howtonode.org/introduction-to-npm Friday, September 14, 12
  7. Developing Packages “I’m working on a package that depends on

    another package i need to update at the same time!!!! HOW?!?!?!” Friday, September 14, 12
  8. Developing Packages In your local repo for the dep you

    need npm link In the project you want to use it in npm link <depname> Friday, September 14, 12
  9. Developing Packages node-plata[master]/$ npm link /usr/local/share/npm/lib/node_modules/plata -> /Users/lucas/projects/exfm/node-plata node-plata[master]/$ cd

    ../user/ user[dev]/$ npm link plata /Users/lucas/projects/exfm/user/node_modules/plata -> /usr/local/share/npm/lib/ node_modules/plata -> /Users/lucas/projects/exfm/node-plata Friday, September 14, 12