Partial and short story:

Your project/application resides in a folder.

In that folder, package.json describes your application. Some important
things:
- name
- dependencies
- scripts
- devDependencies

When you or someone else runs:

npm install

from SUCH FOLDER (usually the root folder of your project), the declared
dependencies are installed (in node_modules subfolder; the package.json of
those dependencies then don't clashes with this package.json)

If you specify a script named test in package.json, then

npm test

runs that script

If your application is an NPM package to be published, the version field is
important. You can publish your package using

npm publish

having an NPM personal account.

There are more uses and variant, but these are the first ones to grasp

For example, this package.json describe one of my examples:
https://github.com/ajlopez/ExpressSamples/blob/master/package.json

(it uses a package.json for many subfolders)
(notice private: true)

Another one, describing an express sample:
https://github.com/ccoenraets/nodecellar/blob/master/package.json

And this one describe one of my NPM modules
https://github.com/ajlopez/SimpleGrammar/blob/master/package.json

Angel "Java" Lopez
@ajlopez




On Wed, Mar 26, 2014 at 11:49 AM, Frank Z <[email protected]> wrote:

> I bought a book on Node.js since I'm teaching myself backend development,
> and in this book the author talks about the importance of package.json
> files. He emphasizes that it's great for keeping track of module
> dependencies in a json format, and installing them all at once using "npm
> install" in a terminal. So far so good...
>
> But how do I assign my package.json to a particular node.js file? Just
> stick it in the same folder??? Does it not clash with the package.json file
> that comes with locally installed npm modules? Do I just make the Name key
> in the json file the exact same as my js file?
>
> Maybe the package.json is simply for putting your project on npm?
>
> I'm totally confused....
>
> Would be cool if there was a node.js expert I could chat with over skype.
> I'm so lost.
>
> --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to