node.js - NPM: module installation for a command line node tool? -


i have command line tool written in node. i'd to:

  • have app able load dependencies , work. currently, after npm install -g <somemodule> module still not available. things didn't used work way.
  • not have run npm link on every folder, have read in npm 1.0 docs. above docs talks $path, seems unrelated topic care node modules, not binaries.

how can/should node command line tool handle dependencies command line tool can run directory?

you can add following in main file of node.js app, assuming file name node-binary.js.

#! /usr/bin/env node  // app code console.log('test node binary'); 

and, in package.json file need specify entry point of app

... "preferglobal": "true", "bin": {     "node-binary": "node-binary.js" }, ... 

and run command npm link in app directory. should able use node-binary command directory.

hope helps... :)


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -