Grunt unable to locate JSDoc (wrong installation/environment)

Recently I set up Himins (a server-side node project) to properly build using Grunt. I got every tool working awesomely in my gruntfile.js except for JSDoc! Grunt give me this clue:

Running "jsdoc:dist" (jsdoc) task
>> Unable to locate jsdoc
Warning: Wrong installation/environnement Use --force to continue.
Aborted due to warnings.

I had previously installed JSDoc with NPM globally and tested it on the command line. Googling around didn’t turn up much at first. I was not going to move JSDoc to a non-standard location just for Grunt!

This blog post, The Best Document Generator for Node, gave me the clues I needed to resolve the problem!

I just had to add

jsdoc: './node_modules/.bin/jsdoc'

to my gruntfile.js!

Why Grunt doesn’t look for JSDoc there in the first place is weird to be. All it’s friends are there. The sample code for using the JSDoc Grunt plug-in doesn’t mention this issue.

You can find my full guntfile.js here.


Posted

in

by

Comments

One response to “Grunt unable to locate JSDoc (wrong installation/environment)”

  1. mugo Avatar
    mugo

    This just saved me some precious time. JSdoc and its ecosystem seems to be losing it.