NOTE: I'm not asking for a solution to a problem - I'm trying to figure out why my solutions aren't being accepted.
Here's their template for submitting a solution:
var fs = require("fs");
fs.readFileSync(process.argv[2]).toString().split('\n').forEach(function (line) {
if (line != "") {
//do something here
//console.log(answer_line);
}
});
So, you are supposed to insert your solution, console.log'ing your output.
And here's what is generated as a result, regardless of what output I submit:
fs.js:338
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
TypeError: path must be a string
at Object.fs.openSync (fs.js:338:18)
at Object.fs.readFileSync (fs.js:182:15)
at Object.<anonymous> (<tmp>/source.js:33:4)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Could someone more knowledgeable in node.js tell me whether codeval is even getting to my code before crashing?
tx.
You're most probably trying to open an input file in a challenge which doesn't provide this input file (i'm a developer at codeeval.com)