Node.js execute Javascript file -
this newbie question , i'm sure solution easy don't it.
i downloaded node.js , put command-tool file , npm in project file.
i created file called example.js contains
console.log("hello world");
now open node file , type in
node example.js
and shows me unexpected identifier.
thanks in advance.
edit:
node -v
shows node not defined ?? .. i'm confused.
edit2: mac ios
edit3: installed , path usr/local/bin allowed move file?
edit4: node -v works now. opened through cmd tool
edit5: okay works.. thought have work node cmd tool. quick help!
- open terminal
- go folder have example.js (use
cd
-command) - type in terminal
node example.js
, pressenter
you should not run node before typing node example.js
Comments
Post a Comment