9

I've been looking around for a Java maven equivalency for NodeJS but can't really seem to find one so I'm posting this question to see whether there're a combination of tools/framework I can use to build and deploy Node. The specific tasks I'm looking for is:

  • Being able to grab dependent modules for a checked out code NodeJS project (for ex. Express or stuff like that)
  • Set up a private repository for NodeJS modules for in-house projects
  • Package with dependencies and make releases of Node projects to a repository (sorta like war)
  • Deploy a release to a remote box and fire up Node

Any help would be greatly appreciated!!!

4
  • So all the node deployments I've been a part of have been updating a git repo, npm install, restart node. Unlike Java world, you don't need a packaged .war file to deploy with in most cases. You can always copy over you npm packages if you want to deploy with them and not install at the location though. Commented Oct 6, 2011 at 1:13
  • I understand that packaged .war is not needed but it's kinda convenient to have 1 file that u know u only need Node on a box to run it instead of worrying about the dependencies. That I can prob overcome with a script that zip the module with node_modules and brand it with version name. The private repo is also kinda a big deal if u do Node development professionally where codes r not open-sourced. Thus idk whether there're anything out there that already integrate those pieces Commented Oct 6, 2011 at 2:36
  • I'm not totally sure the value the private maven repo brings you here from you comments, however you host your own npm repo if you are using packages internally across multiple projects. It's not simple to setup though. Maybe you talking about private git repo? You can host git internally as well if you want. That isn't nearly as hard to setup. Commented Oct 6, 2011 at 2:43
  • Sorry for the confusion in my comment. U're right about the purpose of a private repo for node modules and that's what I also want to do. I can definitely make a private git repo but any shared package would be equivalent to checking out a tag, which is probably ok but I sorta thought there'd be a neater way of doing it. Commented Oct 6, 2011 at 2:59

1 Answer 1

10

Npm does most of that for you.

Dependency handling:

  1. Create a package.json for your project (see required contents or use npm init)
  2. Commit it along your project files, this will be your dependency tracking
  3. npm install will sort out and download all dependencies

Deploying:

  1. Upload/push your files to the server
  2. Either send the node_modules folder along or run npm install on the server
  3. To use your private libraries you'll need to either upload the modules folder or publish them (see below)

Private/local libraries:

  1. Create the library anywhere you want (e.g. ~/Projects/mylib)
  2. go to the mylib folder and run npm link
  3. go to the project's folder and run npm install mylib
  4. Now your local library is symlinked into your project's node_modules

To set up a private repository for your modules, follow these instructions

Sign up to request clarification or add additional context in comments.

1 Comment

Tomasi, You can even use capistrano for deployment, a bit of an annoyance but it will work smoothly once set.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.