How to Run JavaScript in Sublime in Ubuntu Linux
Last updated: September 14, 2024 By Sunil Shaw
In this blog we will learn How to Run JavaScript in Sublime in Ubuntu Linux step by step. I explained in four steps only. Lot’s of people seaching on google for further help, i found it out.
What is Sublime Text++
It is an Open Sources lite weighted code editor/IDE. It is made by C++ and Python, using cross platform technology. Itâs an very light weight yet support all programming language mazorly and markup language. It is develop and design by Jon Skinner in early 2008. It doesnât come with preloaded plugins and other tools developers use, which makes it very lightweighted and popular among learners.
How to Run JavaScript in Sublime in Ubuntu Linux Step By Step
To run or execute JavaScript program in sublime text on ubuntu linux, you have to set Build-System that use nodejs command that runs Javascript file or script.
Step 1: Download and install Node.js in your system.
Skip this step if you have installed it already, move to next step.
Step 1 : Update your sudo apt list
sudo apt update
Step 2: install nodejs using apt
sudo apt install nodejs
Step 3: check the installed nodejs version
node -v
output
v21.6.1
Step 2: Check the path of installed NodeJs
Open your terminal and check where your Nodejs installed.
which node
output: Your output look like this
/usr/local/bin/node
Step 3: Create New Build System
- Go to sublime menu tools
- Then got to Build System
- and then New Build System
Now a untitle file started editing automatically and it will lokk like this.
{
"shell_cmd": "make"
}
now replace this code with above all.
{
"cmd": ["/path/to/your/node", "$file"],
"selector": "source.js"
}
My code see how look like.
{
"cmd": ["/usr/local/bin/node", "$file"],
"selector": "source.js"
}
Now save this file with Javascript.sublime-build
If you done every step then just close the sublime and restart then go ot menu
Tools > Build System > JavaScript
If you selected then start writing your code and execute it by pressing CTRL+B
Also If you want to run PHP in your sublime Read My Another Article
Conclusions
I hope you learned How to Run JavaScript in Sublime in Ubuntu Linux, and started your coding journey.
About Author
I am a Web Developer, Love to write code and explain in brief. I Worked on several projects and completed in no time.
View all posts by Sunil Shaw