in

I can’t run my file "index.js" using Node from the Terminal on Mac. How do I get it to run?


So, I tried to run a file on my Terminal using the “node src” command. Here was the result:

    Timothy@Arthurs-MacBook-Air-2 ~ % node src/index.js
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '/Users/Timothy/src/index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

I expected to be able to open a browser window to http://localhost:4000 & see the file displayed on it. Also, I tried the advice given in the O’Reilly book Javascript Everywhere, and it failed to work in this instance.

How do I resolve this problem, then?



Source: https://stackoverflow.com/questions/70555649/i-cant-run-my-file-index-js-using-node-from-the-terminal-on-mac-how-do-i-get

How to create query for items created on current iteration

All action icons for each class/job are blended together to create new backgrounds for each job/class icon