Reputation: 304
I can't see the output to console.log when I build JavaScript files using a custom Node.js build system in Sublime Text (build 3083) on Linux.
When I try to build jstest.js which contains just console.log("Hello world!");
Sublime Text's console reports Running /usr/bin/node /home/sophie/scripts/jstest.js
and that the build is successful, but I do not see the expected "Hello world!" output.
If I execute node jstest.js
in my Linux terminal, "Hello world!" is properly output, as expected.
I have node installed at /usr/bin/node. The file jstest.js is saved to disk (apparently, Sublime Text will not build unless the file is saved). I'm using the following custom build system (and it is selected before building, of course):
{
"cmd": ["/usr/bin/node", "$file"],
"selector": "*.js"
}
I've tried setting the location to just "node" and also removed the "selector" option, but neither had any effect, there's still no console.log output.
I've looked through a few similar questions and answers here (that's where I obtained the build system code), but nothing has solved the issue for me, yet. Any suggestions?
Upvotes: 2
Views: 3553
Reputation: 41
An alternative would be to use: debug("output here"); This would replace console.log("output here");
Upvotes: 1
Reputation: 51
Try dropping the semi-colon at the end of your line of code, which would give you the following:- console.log("Hello Javascript World!")
There is no semi-colon at the end of the code line, save the file and build. Be sure Node is selected as the build system.
Upvotes: 1
Reputation: 304
Apparently, the issue was a bug either with Sublime Text itself, or the Material Design (https://github.com/equinusocio/material-theme) theme I am using. To solve the issue, I did the following:
That worked for me, at least.
Upvotes: 2