Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How are npm packages managed in nodester?

How are npm packages managed in nodester?


I don't understand how Node packages are managed in Nodester. When I run nodester npm install from CLI I don't see any packages in my app's source folder. Without these packages visible in my folder, can I use them in usual way (as if I had I installed them in my apps folder directly).

I am advised against storing packages directly in the folder since Nodester offers Node PaaS for free and it would be unkind to not optimize my app and make it use minimal space.

Secondly is there a way through which I can run the app both locally and on nodester. How can I tell git not to push the locally installed git modules. I have heard something like git ignore. How do I manage git ignore so that my local packages are not pushed on nodester?

I might not have been eloquent in framing the question as I am a newbie to node so anyone who can put my question in a better way, feel free to Edit this.

Problem courtesy of: Juzer Ali


Generally the best way is to add the node_modules dir to your .gitignore file. My .gitignore looks like this for my node projects:


The first line ignores any Vim temp files, the second to ignore OSX .DS_Store files and the last one ignores my node_modules dir. You will need to delete your node_modules dir from your repo first using git rm if its already committed.

More explination re. gitignore files is here from GitHub.

So that will make Git disregard your node_modules, awesome. Secondly, you will need to create a package.json file. This is what tells npm (and Nodester) what your app depends on.

  "author": "Mr Awesome",  // This is your name :)
  "name": "my_awesome_app",  // This is your apps name 
  "description": "More awesome than most other apps.",  // What your app does
  "version" : "0.0.1",  // Your apps version (increment this when you deploy)
  "node": "0.6.12",  // The version of node you want Nodester to run your app on
  "dependencies": {
     "connect" : "2.0.3", // depend on version 2.0.3 of connect 
     "express" : "*" // depend on the latest version of express

More information about package.json formats can be found here:

When you push to nodester should read the package.json and install your dependencies.

Hope that helps!

Solution courtesy of: antz29


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

How are npm packages managed in nodester?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription