summaryrefslogtreecommitdiff
path: root/deps/npm/doc
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2013-06-18 09:42:42 -0700
committerisaacs <i@izs.me>2013-06-18 09:42:42 -0700
commit9195455637be7ac68274c4e9a83003470efdb0c0 (patch)
tree7e31c781fd40c5b43e504fad2c628081b2678ed6 /deps/npm/doc
parent18574bfaf1c408fd87b69fa4d041a9f3050d6754 (diff)
downloadnode-new-9195455637be7ac68274c4e9a83003470efdb0c0.tar.gz
npm: Upgrade to 1.2.32
Diffstat (limited to 'deps/npm/doc')
-rw-r--r--deps/npm/doc/cli/faq.md149
1 files changed, 94 insertions, 55 deletions
diff --git a/deps/npm/doc/cli/faq.md b/deps/npm/doc/cli/faq.md
index 05b2cd98ec..e00fec61d8 100644
--- a/deps/npm/doc/cli/faq.md
+++ b/deps/npm/doc/cli/faq.md
@@ -72,52 +72,6 @@ Write your own package manager, then. It's not that hard.
npm will not help you do something that is known to be a bad idea.
-## `"node_modules"` is the name of my deity's arch-rival, and a Forbidden Word in my religion. Can I configure npm to use a different folder?
-
-No. This will never happen. This question comes up sometimes,
-because it seems silly from the outside that npm couldn't just be
-configured to put stuff somewhere else, and then npm could load them
-from there. It's an arbitrary spelling choice, right? What's the big
-deal?
-
-At the time of this writing, the string `'node_modules'` appears 151
-times in 53 separate files in npm and node core (excluding tests and
-documentation).
-
-Some of these references are in node's built-in module loader. Since
-npm is not involved **at all** at run-time, node itself would have to
-be configured to know where you've decided to stick stuff. Complexity
-hurdle #1. Since the Node module system is locked, this cannot be
-changed, and is enough to kill this request. But I'll continue, in
-deference to your deity's delicate feelings regarding spelling.
-
-Many of the others are in dependencies that npm uses, which are not
-necessarily tightly coupled to npm (in the sense that they do not read
-npm's configuration files, etc.) Each of these would have to be
-configured to take the name of the `node_modules` folder as a
-parameter. Complexity hurdle #2.
-
-Furthermore, npm has the ability to "bundle" dependencies by adding
-the dep names to the `"bundledDependencies"` list in package.json,
-which causes the folder to be included in the package tarball. What
-if the author of a module bundles its dependencies, and they use a
-different spelling for `node_modules`? npm would have to rename the
-folder at publish time, and then be smart enough to unpack it using
-your locally configured name. Complexity hurdle #3.
-
-Furthermore, what happens when you *change* this name? Fine, it's
-easy enough the first time, just rename the `node_modules` folders to
-`./blergyblerp/` or whatever name you choose. But what about when you
-change it again? npm doesn't currently track any state about past
-configuration settings, so this would be rather difficult to do
-properly. It would have to track every previous value for this
-config, and always accept any of them, or else yesterday's install may
-be broken tomorrow. Complexity hurdle #5.
-
-Never going to happen. The folder is named `node_modules`. It is
-written indelibly in the Node Way, handed down from the ancient times
-of Node 0.3.
-
## Should I check my `node_modules` folder into git?
Mikeal Rogers answered this question very well:
@@ -219,6 +173,96 @@ Git urls can be of the form:
The `commit-ish` can be any tag, sha, or branch which can be supplied as
an argument to `git checkout`. The default is `master`.
+## What is a `module`?
+
+A module is anything that can be loaded with `require()` in a Node.js
+program. The following things are all examples of things that can be
+loaded as modules:
+
+* A folder with a `package.json` file containing a `main` field.
+* A folder with an `index.js` file in it.
+* A JavaScript file.
+
+Most npm packages are modules, because they are libraries that you
+load with `require`. However, there's no requirement that an npm
+package be a module! Some only contain an executable command-line
+interface, and don't provide a `main` field for use in Node programs.
+
+Almost all npm packages (at least, those that are Node programs)
+*contain* many modules within them (because every file they load with
+`require()` is a module).
+
+In the context of a Node program, the `module` is also the thing that
+was loaded *from* a file. For example, in the following program:
+
+ var req = require('request')
+
+we might say that "The variable `req` refers to the `request` module".
+
+## So, why is it the "`node_modules`" folder, but "`package.json`" file? Why not `node_packages` or `module.json`?
+
+The `package.json` file defines the package. (See "What is a
+package?" above.)
+
+The `node_modules` folder is the place Node.js looks for modules.
+(See "What is a module?" above.)
+
+For example, if you create a file at `node_modules/foo.js` and then
+had a program that did `var f = require('foo.js')` then it would load
+the module. However, `foo.js` is not a "package" in this case,
+because it does not have a package.json.
+
+Alternatively, if you create a package which does not have an
+`index.js` or a `"main"` field in the `package.json` file, then it is
+not a module. Even if it's installed in `node_modules`, it can't be
+an argument to `require()`.
+
+## `"node_modules"` is the name of my deity's arch-rival, and a Forbidden Word in my religion. Can I configure npm to use a different folder?
+
+No. This will never happen. This question comes up sometimes,
+because it seems silly from the outside that npm couldn't just be
+configured to put stuff somewhere else, and then npm could load them
+from there. It's an arbitrary spelling choice, right? What's the big
+deal?
+
+At the time of this writing, the string `'node_modules'` appears 151
+times in 53 separate files in npm and node core (excluding tests and
+documentation).
+
+Some of these references are in node's built-in module loader. Since
+npm is not involved **at all** at run-time, node itself would have to
+be configured to know where you've decided to stick stuff. Complexity
+hurdle #1. Since the Node module system is locked, this cannot be
+changed, and is enough to kill this request. But I'll continue, in
+deference to your deity's delicate feelings regarding spelling.
+
+Many of the others are in dependencies that npm uses, which are not
+necessarily tightly coupled to npm (in the sense that they do not read
+npm's configuration files, etc.) Each of these would have to be
+configured to take the name of the `node_modules` folder as a
+parameter. Complexity hurdle #2.
+
+Furthermore, npm has the ability to "bundle" dependencies by adding
+the dep names to the `"bundledDependencies"` list in package.json,
+which causes the folder to be included in the package tarball. What
+if the author of a module bundles its dependencies, and they use a
+different spelling for `node_modules`? npm would have to rename the
+folder at publish time, and then be smart enough to unpack it using
+your locally configured name. Complexity hurdle #3.
+
+Furthermore, what happens when you *change* this name? Fine, it's
+easy enough the first time, just rename the `node_modules` folders to
+`./blergyblerp/` or whatever name you choose. But what about when you
+change it again? npm doesn't currently track any state about past
+configuration settings, so this would be rather difficult to do
+properly. It would have to track every previous value for this
+config, and always accept any of them, or else yesterday's install may
+be broken tomorrow. Complexity hurdle #5.
+
+Never going to happen. The folder is named `node_modules`. It is
+written indelibly in the Node Way, handed down from the ancient times
+of Node 0.3.
+
## How do I install node with npm?
You don't. Try one of these node version managers:
@@ -257,11 +301,6 @@ See `npm-link(1)`
See `npm-registry(1)`.
-## What's up with the insecure channel warnings?
-
-Until node 0.4.10, there were problems sending big files over HTTPS. That
-means that publishes go over HTTP by default in those versions of node.
-
## I forgot my password, and can't publish. How do I reset it?
Go to <https://npmjs.org/forgot>.
@@ -274,8 +313,9 @@ To check if the registry is down, open up <http://registry.npmjs.org/>
in a web browser. This will also tell you if you are just unable to
access the internet for some reason.
-If the registry IS down, let me know by emailing or posting an issue.
-We'll have someone kick it or something.
+If the registry IS down, let me know by emailing <i@izs.me> or posting
+an issue at <https://github.com/isaacs/npm/issues>. We'll have
+someone kick it or something.
## Why no namespaces?
@@ -295,9 +335,8 @@ There is not sufficient need to impose namespace rules on everyone.
## I have a question or request not addressed here. Where should I put it?
-Discuss it on the mailing list, or post an issue.
+Post an issue on the github project:
-* <npm-@googlegroups.com>
* <https://github.com/isaacs/npm/issues>
## Why does npm hate me?