0

I would like to generate automatic documentation for my javascript project using JSDoc running on Nodejs. I did the following:

  1. Installed Nodejs
  2. Installed jsdoc from nodejs as follows: npm install jsdoc

Everything seemed to go well. Then, I run JSDoc on a sample javascript file:

c:>jsdoc d:\version.js

C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\cli.js:341 packageDocs = new Package(props.packageJson); ^ TypeError: undefined is not a function at Object.module.exports.cli.parseFiles (C:\Users\Mark\AppData\Roaming\npm\n ode_modules\jsdoc\cli.js:341:19) at module.exports.cli.main (C:\Users\Mark\AppData\Roaming\npm\node_modules\j sdoc\cli.js:232:14) at Object.module.exports.cli.runCommand (C:\Users\Mark\AppData\Roaming\npm\n ode_modules\jsdoc\cli.js:189:5) at C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\jsdoc.js:178:13 at Object. (C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\ jsdoc.js:180:3) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Function.Module.runMain (module.js:497:10)

Please note I get this error no matter where I run jsdoc from and no matter which javascript file I use.

Can anyone help?

Update If I delete lines 341-343 in cli.js, everything runs fine. Is it possible that these three lines are particular to a particular (i.e. non-windows) environment?

Kesty
  • 560
  • 8
  • 19

2 Answers2

2

You had the misfortune of installing JSDoc on the morning of June 10, just after I introduced bug #662. I fixed the bug later that morning.

The issue is fixed in the most recent version on npm (currently 3.3.0-alpha8).

Jeff Williams
  • 1,791
  • 1
  • 15
  • 9
0

I think it's about case sensitivity.

  1. try to copy a file ( /path/to/node_modules/jsdoc/lib/jsdoc/package.js -> package2.js )
  2. try to modify cli.js ( var Package = require('jsdoc/package').Package; -> var Package = require('jsdoc/package2').Package; )

Good Luck!

barnie
  • 1
  • 2
  • Not quite. The bug was in [Requizzle](https://github.com/hegemonic/requizzle), which JSDoc now uses to meddle with the module-loading process. As a result of the bug, when JSDoc tried to require `jsdoc/package`, it got `node_modules/jsdoc/package.json` instead of `node_modules/jsdoc/lib/jsdoc/package.js`. – Jeff Williams Jun 14 '14 at 14:50