kimmobrunfeldt / git-hours

Estimate time spent on a git repository
MIT License
774 stars 59 forks source link

Installation failed: TypeError: Cannot read property '1' of null #37

Closed madox2 closed 3 years ago

madox2 commented 6 years ago

I am trying to install git-hours on Ubuntu 18.04 and I am getting an error:

/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9
  var args = func.toString().match(/function\s.*?\(([^)]*)\)/)[1];
                                                              ^

TypeError: Cannot read property '1' of null
    at module.exports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/utils/args.js:9:63)
    at /usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:79:29
    at Array.filter (<anonymous>)
    at processExports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:60:6)
    at module.exports (/usr/local/lib/node_modules/git-hours/node_modules/promisify-node/index.js:112:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/git-hours/node_modules/nodegit/generate/scripts/generateNativeCode.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
breck7 commented 6 years ago

I got things working on Ubuntu 16. Details posted here: https://github.com/kimmobrunfeldt/git-hours/issues/34

redcurry commented 5 years ago

I get the same error trying to install on Windows 10. I don't think it's a nodegit issue because I installed nodegit separately and it worked.

TechnoX commented 5 years ago

Having same error on Mint 19, with npm 6.7.0. nodegit is installed without problems

fikrikarim commented 5 years ago

I got exact problem when installing using node v10.16.0

It runs perfectly when I install using node v6.17.1

iplus26 commented 5 years ago

For anyone cannot install this tool using new version of node, it seems to be a problem with dependency nodegit. I assign a specific latest version of nodegit in package.json, it works fine.

{
"devDependencies": {
    "git-hours": "^1.3.0",
    "nodegit": "^0.26.1"
  },
  "resolutions": {
    "nodegit": "^0.26.1"
  }
}

Should be a workaround (also fixed #43 ) before the author publish the new version

iandstanley commented 5 years ago

same error here on node 10 on chromebook's debian installation

$ uname -a Linux penguin 4.19.44-04937-gd773af751792 #1 SMP PREEMPT Thu Aug 8 21:43:29 PDT 2019 x86_64 GNU/Linux

apart from this tool's installation node works perfectly

miramardesign commented 5 years ago

For anyone cannot install this tool using new version of node, it seems to be a problem with dependency nodegit. I assign a specific latest version of nodegit in package.json, it works fine.

{
"devDependencies": {
    "git-hours": "^1.3.0",
    "nodegit": "^0.26.1"
  },
  "resolutions": {
    "nodegit": "^0.26.1"
  }
}

Should be a workaround (also fixed #43 ) before the author publish the new version

Where is nodegit's package.json when installing -g globally?

ndastur commented 3 years ago

Still doesn't work using npm -g install ... Has it not been updated on npm?

marekyggdrasil commented 3 years ago

I worked it out https://github.com/kimmobrunfeldt/git-hours/issues/56#issuecomment-786991024

kimmobrunfeldt commented 3 years ago

After new release 1.5.0, npx git-hours works again! Tested with node 14, macOS. The node version is probably quite specific.