I’m trying to work through the tutorial jobs for Node.io here. I have no trouble running the built-in modules:
echo "mastercard.com" | node.io -s pagerank
Or:
node.io query "http://www.reddit.com/" a.title
However, when I try my own module:
var nodeio= require('node.io');
exports.job = new nodeio.Job({
input: false,
run: function() {
this.emit('Hello World');
}
});
And try to run it with:
node.io hello
I get this:
ERROR: Failed to load job "hello". Please check that the job exists and compiles correctly.
Debugging gives me this:
DEBUG: {"stack":"Error: Cannot find module 'node.io'\n at Function._resolveFilename (module.js:322:11)\n at Function._load (module.js:267:25)\n at require (module.js:351:19)\n at Object.<anonymous> (/Users/username/Documents/Nodejs/hello.js:1:75)\n at Module._compile (module.js:407:26)\n at Object..js (module.js:413:10)\n at Module.load (module.js:339:31)\n at Function._load (module.js:298:12)\n at require (module.js:351:19)\n at [object Object].loadJob (/opt/local/lib/node_modules/node.io/lib/node.io/processor.js:294:37)","message":"Cannot find module 'node.io'"}
I’m sure I’m doing something stupid. Any thoughts?
Edit: responding to answer below
I’ve also tried this:
.npm/node.io/0.2.9-4/package/bin/io -s hello.js
And:
node_modules/node.io/bin/node.io -s hello.js
And get this result:
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'node.io'
at Function._resolveFilename (module.js:322:11)
at Function._load (module.js:267:25)
at require (module.js:351:19)
at Object.<anonymous> (/Users/thaymore/.npm/node.io/0.2.9-4/package/bin/io:2:1)
at Module._compile (module.js:407:26)
at Object..js (module.js:413:10)
at Module.load (module.js:339:31)
at Function._load (module.js:298:12)
at Array.<anonymous> (module.js:426:10)
at EventEmitter._tickCallback (node.js:126:26)
I was able to get it to run like so:
Where
test.jsis simply: