coffeedoc / codo

CoffeeScript API documentation generator. It's like YARD but for CoffeeScript!
Other
625 stars 92 forks source link

Code cannot parse src code #194

Closed victorteokw closed 9 years ago

victorteokw commented 9 years ago

I've tried several versions, neither works. The most recent version (2.0.8 and 2.0.9) generates this error.

localhost:chess 1$ node_modules/codo/bin/codo src/js --output doc
error: Cannot parse Coffee file /path/to/my/project/src/js/controller/base.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/controller/game_controller.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/bishop.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/call.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/chess_board.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/chess_game.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/coordinate.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/king.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/knight.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/pawn.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/piece.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/queen.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/rook.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/model/uuid.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/basic_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/bishop_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/color.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/div_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/game_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/grid_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/king_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/knight_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/label_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/metrics.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/panel_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/pawn_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/piece_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/queen_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/rook_view.js.coffee: node is not defined
error: Cannot parse Coffee file /path/to/my/project/src/js/view/window.js.coffee: node is not defined

/path/to/my/project/node_modules/codo/lib/entities/class.coffee:133
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
                              ^
TypeError: Cannot read property 'length' of undefined
  at Class.module.exports.Entities.Class.Class.linkifyValue (/path/to/my/project/node_modules/codo/lib/entities/class.coffee:97:5)
  at Class.module.exports.Entities.Class.Class.linkify (/path/to/my/project/node_modules/codo/lib/entities/class.coffee:74:10)
  at Environment.module.exports.Environment.linkify (/path/to/my/project/node_modules/codo/lib/environment.coffee:123:12)
  at Object.module.exports.Codo.parseProject (/path/to/my/project/node_modules/codo/lib/codo.coffee:56:17)
  at Command.module.exports.Command.generate (/path/to/my/project/node_modules/codo/lib/command.coffee:106:24)
  at new Command (/path/to/my/project/node_modules/codo/lib/command.coffee:84:8)
  at Function.module.exports.Command.run (/path/to/my/project/node_modules/codo/lib/command.coffee:25:5)
  at Object.<anonymous> (/path/to/my/project/node_modules/codo/bin/codo:14:19)
  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)
  at startup (node.js:119:16)
  at node.js:902:3
tristanjahier commented 9 years ago

I've got the same error here: error: Cannot parse Coffee file /path/hey/plop/blabla.coffee: node is not defined

I'm on Windows 7.

Torthu commented 9 years ago

Same error here as well

I'm using: codo v2.0.9 OS X 10.10.2 node.js v0.10.21 CoffeeScript version 1.9.0

aseemk commented 9 years ago

I was getting this too when Codo's internal CoffeeScript dependency was 1.9. I manually uninstalled it and had it use a 1.8 (higher up node_modules), and it worked fine then.

tristanjahier commented 9 years ago

I don't really know why but my problem auto-solved... I uninstalled coffee-script then re-installed coffee-script 1.8 (npm install coffee-script@1.8.0) and codo. Later, I rolled back to 1.9.0 but it's still working... so I'm confused.

victorteokw commented 9 years ago

It still happens when using coffee1.8.0

bernhard-42 commented 9 years ago

codo uses its own coffee-script folder in codo/node_modules. So the simplest workaround until this is resolved seems to be (at least it worked for me):

Note: The code to document should not use coffeescript 1.9.0 features

bernhard-42 commented 9 years ago

The fix seems to be fairly simple: codo/lib/entities/method.coffee line 9 and 10 are:

 9 constructor: (@environment, @file, @node) ->
10 @name = [node.variable.base.value]

but should be

 9 constructor: (@environment, @file, @node) ->
10 @name = [@node.variable.base.value]

Just add the @ in line 10 in front of node.

harlantwood commented 9 years ago

I had this issue, and using the latest version from github fixes it for me. Tip: to get the latest version from github into your package.json until the fixes are released, just use:

"codo": "coffeedoc/codo",
aseemk commented 9 years ago

Nice work folks. Would you mind publishing this update to npm? Thanks!

inossidabile commented 9 years ago

2.0.11 released