Peter’s Node Commands

NPM

NPM can install packages locally or globally. Locally is the norm.

If a package is install locally it is put in a node_modules directory which can be access by the app with require. To see locally install packages:

$ npm list

I think of this as the git status of npm. Run that shit heeeps.

Globally installed packages are installed somewhere else. To see them (and where they’re installed):

$ npm list -g

Some packages will ask to be installed globally. That’s basically fine. Most of the time local installation is good. Installing is just npm install <package> (local) or npm install -g <package> (global).

You can also use update and uninstall on packages. npm search <word> searches the npm package database. You can also makes npm modules but I’m hella not doing that (yet, at least).

Every package has a package.json which has all its info.

Random Note: There are hella callbacks in node.

n

n is a version management module for node. It is installed through npm which is a little meta I guess but it works.

$ sudo npm install n -g

The results of an update:

$