Im following along with a nodejs book node.js the right way and im stuck when trying to execute this command. I changed #!/usr/bin/env to #!/usr/bin/node because env wasn't even a folder for me and node.js is in the node folder I believe. Im running ubuntu 14.04. Whats the fix? I have couchdb running in the background if that matters. Thanks
ryan@Ryan:~/Documents/code/databases$ ./dbcli.js module.js:340 throw err; ^ Error: Cannot find module '/home/ryan/Documents/code/databases/node --harmony' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:935:3
and heres the program
#!/usr/bin/node node --harmony
/***
* Excerpted from "Node.js the Right Way",
* published by The Pragmatic Bookshelf.
* Copyrights apply to this code. It may not be used to create training material,
* courses, books, articles, and the like. Contact us if you are in doubt.
* We make no guarantees that this code is fit for any purpose.
* Visit http://www.pragmaticprogrammer.com/titles/jwnode for more book information.
***/
const
request = require('request'),
options = {
method: process.argv[2] || 'GET',
url: 'http://localhost:5984/' + (process.argv[3] || '')
};
request(options, function(err, res, body) {
if (err) {
throw Error(err);
} else {
console.log(res.statusCode, JSON.parse(body));
}
});