I created a new folder on my desktop and in that folder I put a file named app.js containing the following code.
function sayHello(name) {
console.log("Hello" + name);
}
sayHello("Noah")
In the terminal I entered node app.js and was returned the following.
module.js:549
throw err;
^
Error: Cannot find module '/home/noah/app.js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
I followed a Digital Ocean tutorial to get everything installed and everything worked as described. Am I putting my files in the wrong location?
node app.jscommand, you should be in the same folder where app.js is present. Uselscommand to check ifapp.jsfile is present under the folder.cdinto folder on desktop that containapp.js.