Installing the NodeJS module

I am trying to install a NodeJS server on a computer with no internet access. I copied the .exe file and executed it, but now I need to install several modules, so my question is this:

Can I just copy modules from my PC? Or do I need to connect the server to the internet and use npm?

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

{
  "name": "MyNodeJS",
  "version": "0.0.1",
  "author": "aaa@aaa.aaa",
  "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", generated file MyNodeJS-0.0.1.tgz with the following structure:

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

      

This is normal? Because I was expecting to have only modules.

+3


source to share


1 answer


You can create your own package.json. List all the modules you need in bundledDependencies

and create the tarball via npm pack

. Copy tarball to new machine and install via npm install <filename>

. It. npm is really sexy .; -)



+7


source







All Articles