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

NodeJS module installation

NodeJS module installation

Problem

I'm trying to install a NodeJS server on a computer without internet access. I copied the .exe and executed it but now I need to install a couple of Modules, so my question is this:

Can I simply copy the modules from my PC? Or must I connect the server to the internet and use npm?

* EDIT : * I already had all the required modules into my PC, so I created the following package.json file:

{
  "name": "MyNodeJS",
  "version": "0.0.1",
  "author": "[email protected]",
  "description": "Modules required for MyNodeJS",
  "main": "index.js",
  "engines": {
    "node": ">= 0.6.6"
  },
  "dependencies": {
    "base64-js" : "0.0.2",
    "bignumber" : "1.1.0",
    "express" : "2.5.6",
    "socket.io" : "0.8.7"
  },
  "bundledDependencies":["base64-js","bignumber","express","socket.io"]
}

and then executed "npm pack" witch created MyNodeJS-0.0.1.tgz file with the following structure:

MyNodeJS-0.0.1.tgz
|- MyNodeJS-0.0.1.tar
   |- package
      |- ALL MY NODEJS CONTENT

Is this normal? Because I was expecting to have only the modules.

Problem courtesy of: Gonçalo Cardoso

Solution

You could create your own package.json. List all the modules you need under bundledDependencies and create a tarball via npm pack. Copy the tarball over to the new machine and install via npm install . That's it. npm is really sexy. ;-)

Solution courtesy of: Sebastian Stumpf

Discussion

View additional discussion.



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

Share the post

NodeJS module installation

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×