Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm package.json defined bin module - command not found

I'm getting command not found... on a bin module I defined in my package.json. Why? I thought it was supposed to automatically map a local command into path.

In my module's package.json:

  "bin": {
    "testme": "./misc/testme"
  },

./misc/testme script:

#!/usr/bin/env node
console.log("this is a test");

It appears in the node_modules/.bin directory

$ ls node_modules/.bin
acorn       escodegen    gulp        kue-dashboard  ncp                 semver               stylus
cake        esgenerate   gzip-size   lessc          nopt                shjs                 testme
cleancss    esparse      handlebars  make-plural    pretty-bytes        sshpk-conv           uglifyjs
coffee      esvalidate   image-size  messageformat  rc                  sshpk-sign           user-home
dateformat  express      jade        mime           retrieve-arguments  sshpk-verify         uuid
dot-object  geojsonhint  jsonlint    mkdirp         rimraf              strip-indent         watchr
errno       grunt        js-yaml     mustache       sails               strip-json-comments  which

But, after npm install when I run it, I get:

$ testme
bash: testme: command not found...
like image 979
eyn Avatar asked Feb 04 '23 10:02

eyn


1 Answers

I believe that running testme would only be possible if you'd install the package globally. In order to run this command (without the global installation) you'd have to npm run testme and add this to your package.json file:

"scripts": {
    "testme": "./bin/testme"

more info here: http://2ality.com/2016/01/locally-installed-npm-executables.html

like image 119
Tamas Avatar answered Feb 08 '23 12:02

Tamas