kucherenko / jscpd

Copy/paste detector for programming source code.
MIT License
4.67k stars 205 forks source link

UnhandledPromiseRejectionWarning: Error: ENOENT #352

Closed alinsoare closed 4 years ago

alinsoare commented 4 years ago

Describe the bug Html report not generated (others are)

To Reproduce Steps to reproduce the behavior:

 $ pwd
/tmp
$ npm install jscpd
npm WARN saveError ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

+ jscpd@3.3.0-rc.5
updated 1 package and audited 987 packages in 1.7s

4 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

$ node node_modules/.bin/jscpd --reporters html ./node_modules/jscpd/
Clone found (javascript):
 - node_modules/jscpd/dist/init/index.js [1:1 - 6:25]
   node_modules/jscpd/dist/print/index.js [1:1 - 6:27]

(node:12907) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/tmp/node_modules/@jscpd/finder/dist/reporters/../../html/report.pug'
    at Object.openSync (fs.js:439:3)
    at Object.readFileSync (fs.js:344:35)
    at handleTemplateCache (/tmp/node_modules/pug/lib/index.js:214:37)
    at Object.exports.compileFile (/tmp/node_modules/pug/lib/index.js:356:10)
    at HtmlReporter.report (/tmp/node_modules/@jscpd/finder/dist/reporters/html.js:14:38)
    at reporters.forEach (/tmp/node_modules/@jscpd/finder/dist/in-files-detector.js:76:26)
    at Array.forEach (<anonymous>)
    at detect.then.then (/tmp/node_modules/@jscpd/finder/dist/in-files-detector.js:75:28)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
(node:12907) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 5205)
(node:12907) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Expected behavior ./report/jscpd-report.html must exists

Desktop (please complete the following information):

Additional context On jscpd v 3.2.1 html report is generated.

kucherenko commented 4 years ago

thank you for the report, investigating the issue

kucherenko commented 4 years ago

fixed at jscpd@3.3.0-rc.6