Open In App

ES6 Environment Setup

Improve
Improve
Like Article
Like
Save
Share
Report

ES6 can run on local machines, only it needs a browser and a text editor. Otherwise, ES6 can run on any host, on any OS. For ES6, it may not be an all-time execution on the browsers. So we need some extra mechanism to execute the ES6 version. 

NodeJS: For web servers, NodeJS is an open-source, cross-platform, JavaScript run-time environment that executes JavaScript code outside of a browser. To install the NodeJS on your machine follow the below links. 

Code Editor: To write the executable code we will require a text editor. In my opinion, VS code editor is the first choice you can choose. To install VS Code follow the below links.

Browser: To run the ES6 program. I prefer to use Google Chrome, there are so many other browsers like Firefox, Internet Explorer, and Safari.

Execute the ES6 code: 

Step 1: Now make a folder anywhere on your PC and run the command prompt in that folder and make an HTML file by using VS Code editor paste the below code inside the file and save it. 

html




<!DOCTYPE HTML>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <meta name="viewport"
              content="width=device-width,
              initial-scale=1.0"/>
        <meta http-equiv= "X-UA-Compatible"
              content="ie=edge"/>
        <title>hello world!</title>
    </head>
    <body>
        <h1>GeeksforGeeks</h1>
        <b>A Computer Science Portal for Geeks</b>
    </body>
</html>


Step 2: Then write the below command in the command prompt, and hit enter. 

npm install http-server -g
  • npm is a package manager for JavaScript programming, by default it is provided by NodeJS. The full form of npm is Node Package Manager. It has many libraries and we can easily use them by Node. here we use a library HTTP-server to establish a server. 

Step 3: Then, after the installation below command will turn on the server. 

http-server -p 1234
//1234 is a random port number

Step 4: After that, open your browser and write the below URL in the search box. Then, the HTML page you make earlier after making the folder will show on the web. 

localhost:1234/filename.html



Last Updated : 14 Apr, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads