The directory to use npm to install package

node.js

Solution

By default, npm will run in local mode, and install scripts into `./node_modules`. This is great if you need to `require` your scripts, as you'll do with Express.

Calling it with the `-g` option installs it globally, wherever node is installed (usually, on Linux, in /usr/local. This is great for packages that are meant to be run using the shell (for example, Supervisor).

Generally, if you want to develop a node.js application under `C:\foo\bar\myapp`, you will run `npm` from there.

FYI, the `$` sign is a general indication meaning that the following command is meant to be run on the command line.

Problem

I just get started on nodejs. I have installed nodejs and npm. Now, I want to install some packages like mongodb and express. As my default directory path in cmd is `C:\>Users\administrator`, do I need to make current folder as nodejs folder to run `npm install express/coffee-script` or I can just run this command under the default directory path mentioned above? By the way, I always see the npm install command provided by others starts with a dollar sign, but I can only use the command without the dollar sign. So what does the dollar sign stand for?

Original source