How to install nodejs and npm on OS-X.
For as big a project as it is, and as widely used as it is, the installation process is retarded and poorly documented. If one simply does an install with the installer from nodejs.org, you end up with permissions problems and their expectation that one will simply chmod 777 /usr/local/lib. The ignorance here is stunning. Just say "no" to such idiocy.
Here are the steps to a clean instllation without going postal on permissions:
$ sudo port install nodejs $ sudo port install npm $ NPM_PACKAGES=~/.npm-global $ mkdir "$NPM_PACKAGES" $ npm config set prefix '~/.npm-global'
That's it. It's that simple. No idiocy involving chown and/or chmod on important directories.