Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How To Open Node.js Command Prompt/Terminal in Mac

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 1
    • 0
    • 10.9k
    Comment on it

    How to open node.js command prompt in mac

    JavaScript is revered as one of the leading programming languages across the globe. As it is built into the majority of web browsers, web designers and programmers use JavaScript to add new designs and interactive features to the websites. However, in the last few years, JavaScript has played a major role outside the browser. 

     

    Node.js is also known as a “JavaScript runtime environment” as it enables you to write the JavaScript code that runs on the computer, independent of any web browser support. However, before you use the Node.js you are required to install it. While the NodeJS website includes an installer, there is a better way to install it on a Mac. This article exhibits the thorough process of opening a Node.js Command Prompt/Terminal on a Mac using Homebrew.

     

     

    Homebrew is a package management software that is used for installation of software on Apple’s macOS operating system. It is free and open-source. It is written in the Ruby Programming language and by default installed into /user/local. It collects the user data and reports to Google Analytics.

     

     

     

     

     

     

    1. To install homebrew type:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

     

    2. To install node, type :

     brew install node

     

    3. check version of nodejs by:

     node v

       Here, "v" refers to version in cmd .

     

    4. Create a node project and create its server file , name it server.js

    
    var http=require(http);
    
    http.createServer(function(req,res){
    
    res.writeHead(200,{Content-Type: text/plain});
    
    res.end(start\n);
    
    }).listen(3000, 127.0.0.1);
    
    
    Console.log(server running at localhost:3000);

     

    5. Now we can start the server by:

    node app.js 

     

    With Node.js installed, users will be able to master the extensive gamut of NPM modules that will help them to create a wide variety of tasks both on the desktop (or laptop) machine and web server. Hope you like the article. Feel free to share your responses in the comments section below.

    How To Open Node.js Command Prompt/Terminal in Mac

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: