I did succeed installing the terminal emulator (Terminus) in sublime text editor but I am bit confuse on how to even get started running my JavaScript files. I can only run JavaScript file in the browser.
Javascript is designed to run inside a javascript engine which is traditionally available inside of browsers. To run javascript on your local machine from a terminal you need an engine to do so. You should look into node.js which is designed for doing exactly this.
Related
Is there a way (in IntelliJ Ultimate) to run any javascript file with NodeJS?
I'm basically looking for the Run command to do
cd DIRECTORY-OF-FILE
node SELECTED-FILE
I would like Debug command to also work; And I realize that not every javascript file is formatted to run in nodejs. :-)
I'm looking for functionality that is built-in for Java (to be able to right click and select run or debug a *.java file).
I have a bunch of sample programs and it is a PITA to create a Run/Debug configuration for each simple script.
What have I done
I've searched the internet intellij run JS file in node
and come up with how to run a single file with NodeJS. https://www.jetbrains.com/help/idea/running-and-debugging-node-js.html#debugLocal. This works ok.
I've searched stack overflow https://stackoverflow.com/search?q=%5Bintellij-idea%5D+run+javascript+file+with+nodejs
And come up with
Project type for executing JavaScript in IntelliJ IDEA - This is very similar and if there were an answer, it would likely answer my question.
Use the Run context menu in the JS file (or the corresponding keyboard shortcut):
When I download node.js from the internet through bash shell commands, am I merely downloading a "functions" folder that has many files in them, or am I downloading anything else besides that?
This question came from the shocking realization I got when I downloaded AngularJS framework and realized it was literally a one page document and nothing more.
Node.js contains a compiled executable that can load and run Javascript code.
This exposes quite a few built in functions that run compiled code within the executable, as well lots of other plain javascript in plain *.js files that make up the standard library.
But to run all that Node.js integrates the V8 javascript engine which is written in C++ and then compiled for your operating system.
When you download Angular, it is meant to run in a browser. That browser provides the execution environment. So all Anglular must provide is it's own code, which you can then leverage for your own projects. Javascript libraries really are just Javascript.
Think of Node.js more like your web browser. It's a program that can execute Javascript, as well as provides the basic functionality you need to write Javascript programs.
As well as a UI, I'd like users to have the option of passing in command line options to my tool and for it to output the response to the command line (eg manually or in cron).
Even without creating a window, the UI gets going (eg taskbar on the mac), and on a linux back-end server with no UI libraries it crashes completely.
Is there a way I can avoid having to ship two apps separately, and also more annoyingly using electron to package up one exe, and something like pkg for the other?
Thanks!
You can use a bundling tool like EncloseJS to wrap your Electron application. This would allow you to write a CLI interface. You would then need to move the code that does the actual work to a shared library that both Electron and your CLI can use. You could then introduce a --headless flag that would simply not start the Electron app, while omitting the flag would start the app as usual.
How can you quit browser-sync from running in the terminal without quitting the terminal application itself?
I am new to using terminal-based frameworks and technologies so this is probably very basic, but I haven't found such command in the guides from their website. What I am trying to do is exiting browser-sync session and keep on using the terminal.
Just Press ctrl + c You will asked to press Y / N And if you press Y then the browser sync will stop along with other command line tools.
I am also relatively new command-line and sorts, but I do believe that any local server can be terminated via "ctrl+c". While I am not sure about the general rule, I do know that ctrl+c works to exit browser sync in the terminal.
I assume you are using this guide to install browser-sync? https://www.browsersync.io/#install
People typically use browser-sync in conjunction with local client-server web development (like editing html and css, etc.), so you typically do not run browser-sync by itself.
Follow this video to get a better idea on how to integrate browser-sync into your workflow for web development: https://www.youtube.com/watch?v=heNWfzc7ufQ
That video shows how to start from a basic html file and use browser-sync to constantly watch for changes.
I'm looking for an IDE or environment, or "graphical console" similar to ISE for PowerShell.
I want to work on some JavaScript but not have a new instance of a node runtime everytime. Just like in the console I want to be able to run some code here and there, and still have access to the variables from commands I ran a few minutes ago. Also i'd love one that also can take the JavaScript Objects or JSON and display them visually rather than just in plain text like the console does.
Is there any IDE for this sort of thing, or are all the Node environments build for starting a new Node instance everytime you run your solution?
I'm not a Javascript programmer, so I don't know exactly if this is what you are looking for, but you might check out Cloud9 IDE. It's web-based, supports Node.js, and saves the exact state of your setup so you wouldn't need to restart anything every time you log in.