Close Menu
The Roaming DevThe Roaming Dev

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Best European Cities For Christmas: A Winter Wonderland Guide

    March 18, 2025

    8 Best AI Development Tools For developers in 2025

    March 5, 2025

    Top AI Tools for Software Development in 2025: Speed Up Your Process

    March 4, 2025
    Facebook X (Twitter) Instagram
    The Roaming DevThe Roaming Dev
    X (Twitter) Instagram Pinterest Reddit
    SUBSCRIBE
    • Home
    • About Us
    • Digital Nomads
      1. Digital Nomads
      2. Travel
      3. Remote Work
      Featured
      Digital Nomads

      Best European Cities For Christmas: A Winter Wonderland Guide

      March 18, 2025
      Recent

      Best European Cities For Christmas: A Winter Wonderland Guide

      March 18, 2025

      Best European Christmas Destinations: Magical Winter Escapes

      March 3, 2025

      How to Move to Europe: The Ultimate Step-By-Step Moving Guide 2025

      January 31, 2025
    • Best Software and Apps

      8 Best AI Development Tools For developers in 2025

      March 5, 2025

      Top AI Tools for Software Development in 2025: Speed Up Your Process

      March 4, 2025

      Best Free VPN for Mac: Top Picks for 2025

      March 1, 2025

      The 10 Best Mail Apps for Mac [Ranked & Reviewed]

      January 29, 2025

      10 Best Free Mac Cleaner Software in 2025

      January 27, 2025
    • Dev Guides

      Top 7 Best PHP Frameworks in 2024

      March 30, 2023

      10 Best Mac Apps For Developers In 2024

      January 28, 2023

      29 Essential VS Code Shortcuts For Mac & Windows Users 2024

      January 27, 2023

      7 Useful VS Code Extensions for Python Developers in 2024

      January 23, 2023

      7 Best VS Code Extensions for Web Developers in 2025

      January 20, 2023
    • Contact
    The Roaming DevThe Roaming Dev
    How To Run Javascript Code In Visual Studio Code Terminal. [Step By Step Guide 2024]
    Dev Guides

    How To Run Javascript Code In Visual Studio Code Terminal. [Step By Step Guide 2024]

    A Beginner Friendly Step-By-Step Guide on how to run Javascript Programs in Visual Studio Code
    The Roaming DevBy The Roaming DevJanuary 15, 2023Updated:May 14, 2024No Comments5 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr WhatsApp Telegram Email
    node js logo
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Table of Contents

    Toggle
    • I. Introduction
    • II. Step-By-Step Guide
      • Step 1: Ensure You Have Node JS Installed in your machine
        • How to Install Node Js On Your Laptop?
          • A. How to Install Node Js on Mac?
          • B. How to Install Node Js on Windows?
      • Step 2: Install Code Runner Extension
      • Step 3: Configure Code Runner Extension to run Javascript Code in Vs Code
      • Step 4: Run Your Javascript Code in Visual Studio Code
    • III. Bonus Tip For Windows Users:
        • How to resolve the “node is not recognized as an internal or external command ” error?
    • IV. Conclusion

    I. Introduction

    In this blog post, I’ll show you how to run Javascript Programs in Visual Studio Code terminal using the CodeRunner extension. We will use a Node Js code example, but this step-by-step applies to executing all other Javascript Frameworks’ code from the VS Code terminal.

    Currently, Javascript is the most popular programming language, with several known frameworks, including Node, Express, React, Vue, Svelte, and Inertia. Javascript is lightweight yet robust.

    Additionally, Javascript is easy to learn and therefore is very beginner friendly.

    Visual Studio Code (VS Code) is a popular choice for Javascript development due to its powerful features and wide range of extensions. One of these features of VS Code is its in-built terminal that allows developers to execute shell commands right within their IDE.

    It is pretty easy to run Javascript code inside VS Code by following these five steps:

    1. Ensure You Have Node JS Installed in your machine
    2. Install Code Runner Extension
    3. Configure Code Runner Extension
    4. Run Your Javascript Code in Visual Studio Code

    Let’s break down each of these steps.

    II. Step-By-Step Guide

    Step 1: Ensure You Have Node JS Installed in your machine

    Before using Javascript in VS Code, you’ll need to have Node Js and NPM installed on your computer. I recommend installing nothing less than Node 18.13.0(including npm 8.19.3). This is because the Long Term Support (LTS) version supports the latest versions of Javascript Frameworks and their features.

    To confirm node is installed on your machine, open terminal and run the following command.

    node -v

    You should get an output as below showing the node version installed.

    v19.0.1

    If you have the output above, proceed to Step 2.

    If you get an error in this step, you must install Node Js and NPM on your laptop. Installing Node on your computer will depend on the operating system in use.

    How to Install Node Js On Your Laptop?

    A. How to Install Node Js on Mac?

    For Mac users, I recommend using HomeBrew to install Node on your machine and for almost any other software you will ever need to install.

    Open your terminal and paste the below command:

    brew install node

    This will install the latest version of Node Js, which at the time of writing is node version 19.

    To install a specific version of Node Js, use the below command and substitute 18 with the respective version of Node Js you want.

    brew install node@18
    B. How to Install Node Js on Windows?

    To install Node Js on your windows laptop, download and Install it from the official website.

    Step 2: Install Code Runner Extension

    The next step is to install the CodeRunner extension for VS Code. This extension allows you to run Javascript code directly from within VS Code.

    You can install CodeRunner from the VS Code Extension Marketplace.

    Code Runner Extension

    Step 3: Configure Code Runner Extension to run Javascript Code in Vs Code

    Once the extension is installed, we are good to go with executing Javascript code from the VS Code terminal. No configurations are needed!

    Step 4: Run Your Javascript Code in Visual Studio Code

    With these steps done, you are ready to run your javascript code using the in-built VS Code terminal using Code Runner.

    CodeRunner can execute your Javascript code using either of these prompts:

    • Right-click from within the VS Code Text Editor and click Run Code.
    run JS code with code runner
    Right Click to Run Javascript Code with Code Runner
    • Press Ctrl + Alt + N on Windows and Shift + Option + N

    To test it out, you can copy this simple Node Js script.

    function hello(name) {
         console.log("hello " + name);
    }
    hello("CSS");

    Your output should be as below.

    Code Runner Js Output
    Code Runner Javascript code output

    III. Bonus Tip For Windows Users:

    How to resolve the “node is not recognized as an internal or external command ” error?

    Some Windows users will get the error message below when they try to execute Javascript code using Code Runner.

    'node' is not recognized as an internal or an external command, operable program or batch file.

    To fix this error, add the Node Executable File Path to Windows Environment Variables.

    1. Ensure Node Js is installed on your laptop
    2. On Your Windows Search, open Control Panel
    3. Click the Advanced System Settings
    4. Click on Environment Variables
    5. In the New System Variable window, add Node Executable File Path to the value of the PATH environment variable
    6. Close and re-open all terminal windows
    Add Node environment Variable
    Add Node Js to Environment Variables In Windows

    IV. Conclusion

    In this blog post, I have shown you how to run your Javascript code in VS Code terminal using the CodeRunner extension. We’ve covered how to install Node and configure VS Code, and how to install and use the CodeRunner extension.

    We have also included a bonus tip to fix a common how to resolve the “node is not recognized as an internal or external command ” error.

    By following these steps, you’ll be able to take advantage of the powerful features of VS Code and CodeRunner to develop and debug your Javascript code.

    Related: How To Run PHP Code in VS Code Terminal

    Picks
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    The Roaming Dev
    • Website

    Related Posts

    Top 7 Best PHP Frameworks in 2024

    March 30, 2023

    Top 10 Best Mac Time Tracking Apps For 2024 [Including Free Options]

    January 30, 2023

    10 Best Remote Collaboration Software For 2024[Pros, Cons & Pricing]

    January 29, 2023

    10 Best Mac Apps For Developers In 2024

    January 28, 2023

    29 Essential VS Code Shortcuts For Mac & Windows Users 2024

    January 27, 2023

    How To Become a PHP Developer in 2024 [Step By Step Beginner’s Guide]

    January 25, 2023
    Add A Comment

    Comments are closed.

    Subscribe to My Newsletter

    Don't Miss
    Digital Nomads

    Best European Cities For Christmas: A Winter Wonderland Guide

    March 18, 2025

    Are you at that point of searching for a magical destination to celebrate christmas? Well,…

    8 Best AI Development Tools For developers in 2025

    March 5, 2025

    Top AI Tools for Software Development in 2025: Speed Up Your Process

    March 4, 2025

    Best European Christmas Destinations: Magical Winter Escapes

    March 3, 2025
    Our Picks

    Top 10 Best Mac Time Tracking Apps For 2024 [Including Free Options]

    January 30, 2023

    10 Best Remote Collaboration Software For 2024[Pros, Cons & Pricing]

    January 29, 2023

    10 Best Mac Apps For Developers In 2024

    January 28, 2023

    How To Become a PHP Developer in 2024 [Step By Step Beginner’s Guide]

    January 25, 2023
    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo
    About The Roaming Dev
    About The Roaming Dev

    Discover the digital nomad lifestyle, remote work insights, travel adventures, developer guides, and top software recommendations on our lifestyle blog. Your hub for a tech-savvy, nomadic journey.

    Email us: theroamingdev@gmail.com

    Follow me on social media for more content!

    X (Twitter) Instagram Pinterest Reddit
    Our Picks

    Top 10 Best Mac Time Tracking Apps For 2024 [Including Free Options]

    January 30, 2023

    10 Best Remote Collaboration Software For 2024[Pros, Cons & Pricing]

    January 29, 2023

    10 Best Mac Apps For Developers In 2024

    January 28, 2023

    How To Become a PHP Developer in 2024 [Step By Step Beginner’s Guide]

    January 25, 2023

    How To Run Javascript Code In Visual Studio Code Terminal. [Step By Step Guide 2024]

    January 15, 2023
    Legal & Compliance
    • Terms Of Use
    • Disclaimer
    • Privacy Policy
    Facebook X (Twitter) Instagram Pinterest
    • Home
    • Digital Nomads
    • Travel
    • Best Software and Apps
    • Dev Guides
    • Troubleshooting Guides
    © 2025 The Roaming Dev

    Type above and press Enter to search. Press Esc to cancel.

    Ad Blocker Enabled!
    Ad Blocker Enabled!
    Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.