1
votes

I'm a fairly new JavaScript programmer and I just downloaded Sublime Text 3. I tried to install node on it so that I can build with javascript but whenever I try and run a simple console.log("Hello World") on it with Ctrl+B, it doesn't display anything but just says [Finished in 0.2s] without actually logging anything to the console.

My sublime build folder for Node is titled Node.sublime-build and contains this:

{
 "cmd": ["node.exe", "${file}"],
 "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
 "working_dir": "${file_path}",
 "selector": "source.js",
 "variants":
 [
  {
   "name": "Run",
   "cmd":["node.exe", "${file}"]
  }
 ]
}

I've searched everywhere for an answer but I just cant figure out why the results don't display. If you know what's wrong please let me know.

1

1 Answers

0
votes

Try replacing all that text in your Node.sublime-build file with:

{   
  "cmd": ["node", "$file"],   
  "selector": "source.js"   
}

or if that doesn't work on the second line you might have to specify the path to node instead of just "node"; for me it's:

{   
  "cmd": ["/usr/local/bin/node", "$file"],   
  "selector": "source.js"   
}