Browse files

Make the "don't use sudo" explanation clearer.

  • Loading branch information...
1 parent 14f1bf8 commit 0164a0df44ae573137d43e3a3df84d032e7345bb @isaacs isaacs committed Sep 29, 2010
Showing with 45 additions and 5 deletions.
  1. +45 −5
@@ -2,7 +2,7 @@
This is just enough info to get you up and running.
-More info available via `man npm`.
+More info available via `npm help` once it's installed.
@@ -16,14 +16,54 @@ To install npm, do this:
curl | sh
+## Permission Errors
If it dies with a "Permission Denied" or EACCESS error, then that probably
means that you are running node in a shared root-owned location. You've
got options.
-Using sudo with npm is Very Not Recommended. Either chown the folder that
-is your node install prefix, or set up a `.npmrc` file pointing `root`,
-`binroot`, and `manroot` to folders that you own. (The .npmrc is just an
-ini-formatted file, so you can use any editor to do this.)
+Using sudo with npm is Very Not Recommended. Anyone can publish anything,
+and package installations can run arbitrary scripts.
+### Option 1: Take ownership
+This is good if you have a single-user machine. Run this command once, and
+never use sudo again to install stuff in /usr/local:
+ sudo chown -R $USER /usr/local
+You could also give your user permission to write into that directory by
+making it group-writable and adding your user to the group that owns it.
+### Option 2: Don't leave $HOME
+Install node in `$HOME/local` and npm will default to living right alongside
+it. Follow the steps in this gist: <>
+### Option 3: Customize npm to your heart's content
+Create and edit a file at `~/.npmrc`. This is an ini-formatted file, which
+you can use to set npm configs. Do something like this to it:
+ cat >>~/.npmrc <<NPMRC
+ root = $HOME/.node_libraries
+ binroot = $HOME/bin
+ manroot = $HOME/share/man
+You *can* just use sudo all the time for everything, and ignore the incredibly
+obnoxious warnings telling you that you're insane for doing this.
+ # you must REALLY trust me to do this!
+ curl | sudo sh
+ sudo npm ls
+ sudo npm install please-pwn-my-machine-kthx
+If this causes horrible things to happen, you can't say I didn't warn you over
+and over again until everyone got sick of hearing about it and told me to shut
+up already.
## More Fancy Installing

0 comments on commit 0164a0d

Please sign in to comment.