Thursday, 25 May 2017

Problems creating a CLI tool to distribute on NPM for local installation only

I have created a simple CLI tool what I want users to install and have commands available while the user is cd'd into a project. Let me describe:

  1. Inside my cli-tools project, the package defines the following:

    {
       "bin": {
          "foo-script": "./bin/foo-script"
       }
    }
    
    
  2. User installs script (directly from github at the moment, it's a private tool):

    npm install git+https://...../cli-tools --save
    
    
  3. At this point, if the user types which foo-script, they see:

    node_modules/.bin/foo-script
    
    

    Most user have ./node_modules/.bin as part of their $PATH

  4. Upon executing foo-script, the following complain arises:

    /Users/meee/.nvm/versions/node/v6.10.0/bin/pg-util: No such file or directory
    
    

Sooo, how can I get users to install my script using npm, and have the commands listed under "bin" directly available? Thanks?



via Ryan Wheale

No comments:

Post a Comment