0

Summary: is there a way to list a dependency for your to-be-published npm module as global?

I'm currently authoring an npm module which relies on JSHINT as a main dependency. The idea for my module is to be able to call JSHINT programmatically from Node. I do this by using fs.exec on the jshint command.

The problem, however, is that unless the JSHINT is installed globally (npm -g install jshint), when executing the jshint command (even from the command line), I get:

-bash: jshint: command not found

I've looked around and can't seem to find a solution. What I've found so far hasn't worked.

I was wondering, then, when authoring an NPM package to be published, is there a way to list one of the dependencies as a global dependency which must be installed with -g by npm when users install my module?

tborenst
  • 972
  • 2
  • 9
  • 18
  • @hexacyanide Thanks, that answers it. Is there a way to close this question? – tborenst Dec 11 '13 at 23:57
  • You can delete it, or you can wait for it to be closed as a duplicate. – hexacyanide Dec 11 '13 at 23:57
  • If you are relying on the `jshint` module, why are you using the command line command instead of loading the module and calling it directly? Then you avoid this whole problem. – loganfsmyth Dec 12 '13 at 01:00
  • @loganfsmyth I don't believe it's meant to be used that way. The JSHint module exposes a single JSHINT function, but it is undocumented (as far as I can tell) and it's unclear to me what it does due to badly named, single-letter variable names. That was the first thing I tried though, and I'm sure that it could work with a lot more work on my end. I had to go with this "simpler" solution because I need to continue working on other parts of the project I am working on. – tborenst Dec 12 '13 at 07:50

0 Answers0