git-stats icon indicating copy to clipboard operation
git-stats copied to clipboard

TypeError: Cannot set property 'NaN' of undefined

Open kdavis opened this issue 8 years ago • 8 comments

System:

  • Windows 10
  • NodeJS v6.9.5
User@DesktopPC MINGW64 /e/Git/GitStatsTest (branch/test)
$ git-stats -a
C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-graph\lib\index.js:63
    self.graph[settings.center.y][settings.center.x] = settings.marks.center;
                                                     ^

TypeError: Cannot set property 'NaN' of undefined
    at new CliGraph (C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-graph\lib\index.js:63:54)
    at new CliCircle (C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-circle\lib\index.js:35:18)
    at CliPie.toString (C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-pie\lib\index.js:170:18)
    at C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:612:87
    at C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:548:9
    at LimitIt.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\gry\lib\index.js:86:17)
    at C:\Users\User\AppData\Roaming\npm\node_modules\git-stats\node_modules\limit-it\lib\index.js:138:20
    at ChildProcess.exithandler (child_process.js:197:7)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)

kdavis avatar Feb 02 '17 16:02 kdavis

Whoups! Debugging is welcome since I do not have a Windows machine around...

IonicaBizau avatar Feb 03 '17 08:02 IonicaBizau

I put a console.log above the offending line.

console.log(settings);
self.graph[settings.center.y][settings.center.x] = settings.marks.center;

It seems the settings.center children nodes are NaN for some reason, could be a Windows bug?

{ width: NaN,
  height: NaN,
  marks:
   { hAxis: ' ',
     vAxis: ' ',
     center: ' ',
     point: ' ',
     rightArrow: ' ',
     topArrow: ' ',
     background: ' ' },
  center: { x: NaN, y: NaN }, // <- Here
  aRatio: 1 }

kdavis avatar Feb 03 '17 14:02 kdavis

Whoups!

This is the place here the centers are set: https://github.com/IonicaBizau/node-cli-graph/blob/4f3acc270e5718ebc8b087c750b369551976df56/lib/index.js#L49-L55

IonicaBizau avatar Feb 06 '17 17:02 IonicaBizau

i have the same problem

yangjiebeijing avatar Feb 13 '17 06:02 yangjiebeijing

It looks like the defaults aren't being merged with the options. settings = self.options = Ul.deepMerge(options, CliGraph.defaults)

kdavis avatar Feb 15 '17 09:02 kdavis

For me it happens in the git bash. In the cmd.exe it looks ok. Can anyone confirm that?

mjamro avatar Jan 15 '18 19:01 mjamro

@mariuszjamro I can confirm the -a works in cmd.exe but not in Git Bash, however the coloring/scale is broken in cmd.exe.

mistresseve666 avatar Feb 05 '18 22:02 mistresseve666

I confirm this issue under Windows 7. Also confirm using cmd.exe produces no usable output even not with --disable-ansi git-bash ouput is not same as screenshots on main git page, but it's ok.

codexp avatar Mar 14 '18 10:03 codexp