SublimeText 2 Javascript console

2019-07-15 23:01发布

问题:

I'm a SublimeText2 and Javascript newbie, using Windows8.
I'm trying to create a Javascript Console in Sublime Text.

I've tried 2 methods, but none worked with me!


METHOD 1:

I've installed "Nodejs Sublime Text 2 Package" found here:
https://github.com/tanepiper/SublimeText-Nodejs

But when I press Alt + R (run current script in node), I just get a message that says:
´kill' is not recognized as an internal or external command, operable program or batch file.

The error message appears in a black windows with the title C:\WINDOWS\system32\cmd.exe", it just appears and disappears in half a second (but I was able to make a print screen).


METHOD 2:

I've tried to use a javascript console by installing NodeJS, as instructed here: http://www.wikihow.com/Create-a-Javascript-Console-in-Sublime-Text see Method 2 of 2: Using Node.js

But when I press Ctrl+B or F7 although the console appears (in bottom area of SublimeText2) and I can read "Building" in the footer information, THE CONSOLE KEEPS COMPLETELY CLEAN, WITH NO RESULTS WHATSOEVER!


So I'm stuck! Please help!

回答1:

Try using SublimeREPL. I have used it quite successfully, although on Win 7.

With tanepiper's plugin, you may have to fiddle with setting paths (I remember them having issues with windows)

{
 // if present, use this command instead of plain "node"
  // e.g. "/usr/bin/node" or "C:\bin\node.exe"
  "node_command": false,
  // Same for NPM command
  "npm_command": false,
  // as 'NODE_PATH' environment variable for node runtime
  "node_path": false,

}