kessler / license-report

create a short report about a project's dependencies (license, url etc)
MIT License
236 stars 39 forks source link

TypeError: Cannot read property 'email' of undefined #67

Closed chinskiy closed 2 years ago

chinskiy commented 2 years ago

Greetings!

For package, https://www.npmjs.com/package/react-hook-form library throws an error if it's specified in package.json

Steps to reproduce:

Save to package.json

{
  "name": "react_hook_bug",
  "version": "1.0.0",
  "description": "test",
  "main": "index.js",
  "scripts": {
    "test": "exit 0"
  },
  "keywords": [
    "keywords"
  ],
  "author": "author",
  "license": "ISC",
  "dependencies": {
    "react-hook-form": "^7.27.0"
  }
}

license-report command with raise exception like below

/usr/local/lib/node_modules/license-report/lib/getPackageReportData.js:57
            if (author.email) { author = author + ' ' + author.email; }
                       ^

TypeError: Cannot read property 'email' of undefined
    at /usr/local/lib/node_modules/license-report/lib/getPackageReportData.js:57:15
    at /usr/local/lib/node_modules/license-report/lib/getPackageJson.js:22:3
    at Stubborn.p._onTaskExecuted (/usr/local/lib/node_modules/license-report/node_modules/stubborn/lib/Stubborn.js:71:18)
    at wrapper (/usr/local/lib/node_modules/license-report/node_modules/lodash/lodash.js:4991:19)
    at /usr/local/lib/node_modules/license-report/node_modules/lodash/lodash.js:10118:25
    at Request._callback (/usr/local/lib/node_modules/license-report/lib/getPackageJson.js:55:11)
    at Request.self.callback (/usr/local/lib/node_modules/license-report/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/usr/local/lib/node_modules/license-report/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:198:13)

Version: license-report@4.5.0

BePo65 commented 2 years ago

I tested your case with the latest version (just to be released) and it did not show any errors. So it should be ok.

Please test it as soon as the latest version is released. Looking forward to your feedback.

chinskiy commented 2 years ago

Thanks for the fast reply!

I've pulled master and installed it Issue indeed not reproducible there, in such a case think that issue may be closed