FAQ: Learn Node.js - Running a Program with Node

hello world the file must be inside a folder for the node myProgram.js to print hello world. so make sure its in a folder then cd to the folder

What did your sentence turn out to be? Without thinking much, I’ve chosen some random nouns, an adjective, and a verb. And I got:

The world’s first pig was a very notorious star who loved to kill while eating snake for every meal.

I tried this same exercise on my computer in a text editor. I have node.js installed and tried to execute the file, but got some error saying that the file doesn’t exist.

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:900:15)
at Function.Module._load (node:internal/modules/cjs/loader:745:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:72:12)
at node:internal/main/run_main_module:17:47 {
code: ‘MODULE_NOT_FOUND’,
requireStack:

I am receiving the error above