P
P
Pavel Grudinkin2016-04-29 02:47:05
Node.js
Pavel Grudinkin, 2016-04-29 02:47:05

How to deploy a Node.js project?

There is a ready-made project on Node.js, which I encounter for the first time. I don't understand how to run it.
For example node run.js, it gives an error regardless of versions and OS:

module.js:327
    throw err;
    ^

Error: Cannot find module './lib'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/admin/rails_projects/mynode/run.js:17:9)
    at Object.<anonymous> (/Users/admin/rails_projects/mynode/run.js:145:4)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)

Do I understand correctly that npm is an analogue of bundler in RoR and I need to do an analogue of bundle install (npm install does not work)?
Update 3
npm start is getting closer:
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.4.3
npm ERR! npm  v2.15.1
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] start: `coffee run.coffee`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] start script 'coffee run.coffee'.
npm ERR! This is most likely a problem with the darkside package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     coffee run.coffee
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs darkside
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! 
npm ERR!     npm owner ls darkside
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/admin/rails_projects/mynode/npm-debug.log

Update 2
node app.js gives:
module.js:327
    throw err;
    ^

Error: Cannot find module './routes'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/admin/rails_projects/mynode/app.js:27:12)
    at Object.<anonymous> (/Users/admin/rails_projects/mynode/app.js:109:4)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)

Update 1
package.json:
{
  "name": "darkside",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "./node_modules/.bin/coffee run.coffee"
  },
  "dependencies": {
    "basic-auth": "^1.0.0",
    "bluebird": "^2.9.24",
    "body-parser": "~1.12.0",
    "coffee-script": "^1.9.2",
    "compression": "^1.5.0",
    "connect-coffee-script": "^0.2.1",
    "cookie-parser": "~1.3.4",
    "cookie-session": "^1.1.0",
    "cookies": "^0.5.0",
    "cron": "^1.0.9",
    "csurf": "^1.8.0",
    "debug": "~2.1.1",
    "email-verify": "0.0.12",
    "express": "~4.12.2",
    "express-session": "^1.11.1",
    "helmet": "^0.7.1",
    "jade": "~1.9.2",
    "knex": "^0.7.6",
    "konfig": "^0.2.1",
    "later": "^1.1.6",
    "lodash": "^3.7.0",
    "log4js": "^0.6.23",
    "md5": "^1.0.0",
    "moment": "^2.10.2",
    "morgan": "~1.5.1",
    "multer": "^0.1.8",
    "nib": "^1.1.0",
    "node-watch": "^0.3.4",
    "pg": "^4.3.0",
    "pg-hstore": "^2.3.2",
    "qs": "^2.4.1",
    "random-ua": "0.0.6",
    "raygun": "^0.6.0",
    "request": "^2.55.0",
    "sendmail": "^0.2.1",
    "sequelize": "^2.0.6",
    "serve-favicon": "~2.2.0",
    "shortid": "^2.2.2",
    "socks5-http-client": "^1.0.1",
    "stylus": "0.42.3",
    "sypexgeo-vyvid": "^0.2.3",
    "unzip": "^0.1.11",
    "wget-improved": "^1.0.1"
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-04-29
@Hunt666

Call npm i in the project folder and then run

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question