Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-09-29 04:01:56 +0400
committerisaacs <i@izs.me>2010-09-29 04:01:56 +0400
commit0164a0df44ae573137d43e3a3df84d032e7345bb (patch)
tree8c4e197b1cf67a7fccb95e4bfb0ad248bdb7b418 /README.md
parent14f1bf81d31a8b76de2d6e71603041f284259d8d (diff)
Make the "don't use sudo" explanation clearer.
Diffstat (limited to 'README.md')
-rw-r--r--README.md50
1 files changed, 45 insertions, 5 deletions
diff --git a/README.md b/README.md
index 7b5026e0e..b116709f4 100644
--- a/README.md
+++ b/README.md
@@ -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.
## IMPORTANT
@@ -16,14 +16,54 @@ To install npm, do this:
curl http://npmjs.org/install.sh | 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: <http://gist.github.com/579814>
+
+### 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
+ NPMRC
+
+### Option 4: HOLY COW NOT RECOMMENDED!!
+
+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 http://npmjs.org/install.sh | 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