IonicaBizau / git-stats

🍀 Local git statistics including GitHub-like contributions calendars.
MIT License
6.42k stars 183 forks source link

Not working on Windows Git Bash #151

Open vetu11 opened 5 years ago

vetu11 commented 5 years ago

Just downloaded and tried it on Windows. It works on the cmd, but on the Git Bash shows this error:

C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-gh-cal                                                                                                                \lib\index.js:53
    var CLI_COLUMNS = require('window-size').width;
                                            ^

TypeError: Cannot read property 'width' of undefined
    at CliGhCal (C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_m                                                                                                                odules\cli-gh-cal\lib\index.js:53:45)
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:513                                                                                                                :24
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:414                                                                                                                :9
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:315                                                                                                                :9
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_modules\r-j                                                                                                                son\lib\index.js:23:13
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
$ git-stats -v
git-stats 2.10.11

$ git --version
git version 2.11.1.windows.1
zhangleixp commented 5 years ago

Just downloaded and tried it on Windows. It works on the cmd, but on the Git Bash shows this error:

C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_modules\cli-gh-cal                                                                                                                \lib\index.js:53
    var CLI_COLUMNS = require('window-size').width;
                                            ^

TypeError: Cannot read property 'width' of undefined
    at CliGhCal (C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_m                                                                                                                odules\cli-gh-cal\lib\index.js:53:45)
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:513                                                                                                                :24
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:414                                                                                                                :9
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:315                                                                                                                :9
    at C:\Users\vetu\AppData\Roaming\npm\node_modules\git-stats\node_modules\r-j                                                                                                                son\lib\index.js:23:13
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
$ git-stats -v
git-stats 2.10.11

$ git --version
git version 2.11.1.windows.1

to fix this problem only: find the file here: %AppData%\Roaming\npm\node_modules\git-stats\node_modules\window-size\index.js

modify two lines: line 17: module.exports = utils.get(); => module.exports = utils.win();

line 24: define(module.exports, 'get', utils.get); => define(module.exports, 'get', utils.win);

this way just simply the error of require('window-size'), after this, there is annother error appeared, and I don't kown how to fix it.

$ git-stats --raw | git-stats-html -o out.html
invisible cygwin console[15756]: c:\ws\src\tcp_wrap.cc:137: Assertion `args[0]->IsInt32()' failed.
 1: 00007FF61494F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
 2: 00007FF61492A0C6 node::MakeCallback+4518
 3: 00007FF61492A17F node::MakeCallback+4703
 4: 00007FF6148760A4 v8::internal::compiler::Type::Type+12612
 5: 00007FF61512C122 v8::internal::OptimizingCompileDispatcher::Unblock+59890
 6: 00007FF61512D289 v8::internal::OptimizingCompileDispatcher::Unblock+64345
 7: 00007FF61512C5CC v8::internal::OptimizingCompileDispatcher::Unblock+61084
 8: 00007FF61512C4EB v8::internal::OptimizingCompileDispatcher::Unblock+60859
 9: 0000017ED98DC5C1
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: EPIPE: broken pipe, write
    at Socket._write (internal/net.js:58:25)
    at doWrite (_stream_writable.js:410:12)
    at writeOrBuffer (_stream_writable.js:394:5)
    at Socket.Writable.write (_stream_writable.js:294:11)
    at display (C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\bin\git-stats:193:24)
    at C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:513:9
    at C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:414:9
    at C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:315:9
    at C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\node_modules\r-json\lib\index.js:23:13
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:425:12)
    at onwrite (_stream_writable.js:456:5)
    at Socket._write (internal/net.js:62:14)
    at doWrite (_stream_writable.js:410:12)
    [... lines matching original stack trace ...]
    at C:\Users\Ray\AppData\Roaming\npm\node_modules\git-stats\lib\index.js:315:9
jimmycasey commented 5 years ago

I'm getting this 'window-size' error inside a node alpine container. Wonder if there is something missing that I need to install? @vetu11 @zhangleixp you folks ever find out the issue?

jimmycasey commented 5 years ago

Created a Dockerfile with dependencies for git-stats and git_stats https://github.com/jimmycasey/git-stats-git_stats/blob/master/Dockerfile

sbmueller commented 4 years ago

Same with Cygwin and Win10.

vogler commented 1 year ago

@jimmycasey Solved it on alpine by manually setting the size: ROWS=50 COLUMNS=140 git-stats -g. See https://github.com/jonschlinkert/window-size/issues/17