Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got an error while using the output option in the .cpd.yaml file #6

Closed
rchavarria opened this issue May 8, 2014 · 2 comments
Closed

Comments

@rchavarria
Copy link

I got the following error when I use the output option in the configuration file .cpd.yaml:

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
TypeError: path must be a string
  at Object.fs.openSync (fs.js:427:18)
  at Object.fs.writeFileSync (fs.js:966:15)
  at Report.generate ([...]\node_modules\jscpd\src\report.coffee:31:8)
  at jscpd.run ([...]\node_modules\jscpd\src\jscpd.coffee:112:23)
  at Object.<anonymous> ([...]\node_modules\jscpd\src\cli\cli.coffee:33:10)
  at after ([...]\node_modules\jscpd\node_modules\cli\cli.js:1003:18)
  at Object.cli.main ([...]\node_modules\jscpd\node_modules\cli\cli.js:1008:9)
  at Object.<anonymous> ([...]\node_modules\jscpd\src\cli\cli.coffee:26:5)
  at Object.<anonymous> ([...]\node_modules\jscpd\src\cli\cli.coffee:1:1)
  at Module._compile (module.js:456:26)
  at Object.loadFile ([...]\node_modules\jscpd\node_modules\coffee-script\lib\coffee-s
cript\register.js:16:19)
  at Module.load ([...]\node_modules\jscpd\node_modules\coffee-script\lib\coffee-scrip
t\register.js:45:36)
  at Function.Module._load (module.js:312:12)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> ([...]\node_modules\jscpd\bin\jscpd:4:1)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:901:3

I have tried to use relative paths:
"jscpd-report.xml"
or:
"./jscpd-report.xml"
and absolute paths like (on Windows):
"C:\Users\myuser\jscpd-report.xml"
and absolute paths without backslash:
"C:/Users/myuser/jscpd-report.xml"

All of them with the same result: TypeError: path must be a string.

Here, you can find the .cpd.yaml file used:

languages:
  - javascript
files:
  - "**/*.js"
exclude:
  - "**/*.min.js"
output:
  - "jscpd-report.xml"
@kucherenko
Copy link
Owner

Hello,

Output can be string only, try to use this code in .cpd.yaml

languages:
  - javascript
files:
  - "**/*.js"
exclude:
  - "**/*.min.js"
output: "jscpd-report.xml"

@rchavarria
Copy link
Author

Thanks, it works perfectly!
Sorry for opening an issue for such a silly question. It was due to I wrote a wrong yaml format, not due to jscpd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants