jBroheimScience
jBroheimScience

Reputation: 11

node.js "Command not found"

I am attempting to work with node and learning how to write in Javascript. I am currently trying to use my terminal to run a basic "Hello world" js file using node. However, when I attempt to use $node index.js (that's what the file is called). All the terminal responds with is index.js command not found. I tried to do it with the just the terminal window, I have also tried to run it through the integrated terminal within data studio, so I am unsure of where I went wrong.

Here is a screen shot of my window.

Upvotes: 1

Views: 3491

Answers (1)

user13558124
user13558124

Reputation:

Remove the $ sign. In web examples, docs use $ to show that you run it in the command line.

Instead use node index.js, or set up a package.json file and use npm start (npm start should contain node index.js).

Final Clarification (if you didn't understand the above explanation)

Run node index.js. $ is never used, except to show you that the command is used in the command line.

Upvotes: 2

Related Questions