nodeshift-archived / license-reporter

license-reporter is a tool that gathers licenses for project's dependencies and produces a output in XML, JSON, YAML and HTML format.
Apache License 2.0
13 stars 10 forks source link

[Bug] TypeError: path must be a string or Buffer #190

Closed lgriffin closed 6 years ago

lgriffin commented 6 years ago

While running the licenser on https://github.com/feedhenry-raincatcher/raincatcher-portal I get the following error:

TypeError: path must be a string or Buffer at TypeError (native) at Object.fs.open (fs.js:632:11) at ReadStream.open (fs.js:1951:6) at new ReadStream (fs.js:1938:10) at Object.fs.createReadStream (fs.js:1885:10) at dependencyLicenseFiles.forEach.d (/Users/lgriffin/GIT_testing/Bucharest/license-reporter/lib/file-writer.js:110:8) at Array.forEach (native) at Object.copyLicenseFiles (/Users/lgriffin/GIT_testing/Bucharest/license-reporter/lib/file-writer.js:108:26) at checkLicense.then.xmlObject (/Users/lgriffin/GIT_testing/Bucharest/license-reporter/bin/cli.js:196:16) at process._tickCallback (internal/process/next_tick.js:109:7)

Note that the Approved and Not Approved Licenses section runs and populates correctly beforehand, so I can see the full output. The license.xml is generated and the _MIT license.txt is created.

I'm guessing it is a problem with copying one of the text files (from the line of code). The tool should survive an error like this and skip a file that is causing problems and alert the user at the end.

lgriffin commented 6 years ago

Repeatable with:

https://github.com/feedhenry-raincatcher/raincatcher-mobile https://github.com/feedhenry-raincatcher/raincatcher-server

MY hypothesis is the volume of dual licenses in the above 3 repos. I see a lot of Dual licenses with AND + OR combinations in place. I'm wondering could this be tied to the copying function trying to hit two places for scenarios around dual licenses?

helio-frota commented 6 years ago

I'm still on this issue, it has 2 bugs, only one solved until now related with file not found.

Other than that 2 bugs:

But a side note is that some README.md files are considerated as "License file" even if no # License section is defined. maybe this will be another issue ?

This is weird, I'm not 100% sure but I think this is from license-checker tool.

example: see the @raincatcher-examples/angularjs-extensions/README.md file, it has no content related with licenses/legal.

helio-frota commented 6 years ago

@lgriffin thanks for report this bug!

the warning message when no license file is found is :

========= WARNING                  ==========
No license file was found for: @raincatcher-examples/step-accident
========= WARNING                  ==========
helio-frota commented 6 years ago

closing and created a new one related to README.md https://github.com/bucharest-gold/license-reporter/issues/193

lgriffin commented 6 years ago

Excellent thanks for the prompt response!