bin.js 515 B

1234567891011121314151617181920212223
  1. module.exports = bin
  2. var npm = require('./npm.js')
  3. var osenv = require('osenv')
  4. var output = require('./utils/output.js')
  5. bin.usage = 'npm bin [--global]'
  6. function bin (args, silent, cb) {
  7. if (typeof cb !== 'function') {
  8. cb = silent
  9. silent = false
  10. }
  11. var b = npm.bin
  12. var PATH = osenv.path()
  13. if (!silent) output(b)
  14. process.nextTick(cb.bind(this, null, b))
  15. if (npm.config.get('global') && PATH.indexOf(b) === -1) {
  16. npm.config.get('logstream').write('(not in PATH env variable)\n')
  17. }
  18. }