skip to Main Content

I opened the terminal on my mac, and first checked that I have node installed: node -v
v14.17.5

I then tried to open a file I created index.html from Visual Studio Code and I got a throw err from the terminal. { The code:’Module_NOT_FOUND’, requireStack:[] }

Thank you in advance for help.

2

Answers


  1. node is a runtime environment that can execute javascript on a machine. So it can’t read html file, but only js files. You can execute a js file with the following command in the terminal: node index.js

    Et voilà.

    Please note you can also write javascript directly in your terminal by entering a node environment.

    node
    const a = "hello"
    a
    
    // return "hello"
    Login or Signup to reply.
  2. I think you are trying to run an html file using node
    just change the index.html to index.js

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search