Academia.eduAcademia.edu

Getting Started with Node.JS and Node Package Manager NPM

2018

You can view the online version here: https://developing-an-organic-web-channel.ghost.io/2018/07/18/getting-started-with-node-js/ Node.JS is an RTE (application run time environment). In web application architecture server-side applications provide complex processing capability (similar to desktop applications). Node.JS allows you to run Javascript applications on the web server instead of in the browser. There's a number of reasons this is beneficial. The biggest advantages of server-side Javascript is for more capable web applications and to improve the user experience in the browser.

Getting Started with Node.JS and Node Package Manager NPM 18 JULY 2018 / WEB DEVELOPMENT Getting Started with Node.JS and Node Package Manager NPM By Dan ie l J. Le Blan c, Sr. We b De ve lo pe r, MCS What is Node.JS and when to use it? Node.J S is an RTE (application run tim e environm ent). In web application architecture server-side applications provide com plex processing capability (sim ilar to desktop applications). Node.J S allows you to run J avascript applications on the web server instead of in the browser. There's a num ber of reasons this is benefcial. The biggest advantages of server-side Javascript is for file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM m ore capable web applications and to im prove the user experience in the browser. Very com plex J avascript applications where data is processed or parsed, for instance, could take longer if the processing is happening within the browser rather than over on the web server. Som e kinds of processing requires continuous com m unication back and forth between the browser and the server. In early web architecture this was a m ajor challenge. Node.J S provides push technology to web developm ent. Or further, it provides us with 2-way com m unication between the client and the server for web developm ent. The other advantages include security, since a web server can be better hardened against hackers than a web browser, and also for code efciency since server-side applications can be written more efciently. What is NPM (Node Package Manager) and when to use it? Node Package Manager is a code package m anager and installer. It saves web developers m any hours of program m ing tim e by providing a code repository of over 60 0 ,0 0 0 pieces of code to build web applications in a m odular style. J avascript developers upload m odules of code that other developers can share. NPM provides the storage, sharing and download capability and m akes it convenient to use. That being said, there is a learning curve as with any software. The NPMJ S website provides training m aterials for all of the m ost com m on file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM tasks. As of the writing of this article (J uly 20 18) NPM experiences over 3 billion downloads per week from all over the world and developers from every continent use NPM to share code packages. NPM also ofers a paid resource that allows you to use NPM privately and m any software retailers use it to publish and distribute copyrighted code discreetly. The CLI (com m and line interface) syntax for NPM is available from the NPM website. How to Insall Node.JS for PC 1) Download the Windows Installer from the Node.js website. Choose the option that is correct for your Windows m achine. 2) Once the package download com pletes then run the installer; 3) Click [Next] at the initial installer screen; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 4) Accept the End-User License Agreem ent by checking the box and then click [Next]; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 5) Change the directory to the desired path or accept the default directory for installation. Then click [Next]; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 6) Here you have the option to accept the custom installation setup or to choose and select only the desired features. You will likely want the entire package and particularly the npm package m anager. Unless you have experience with this I would suggest you allow the standard set-up to occur. Then click [Next]; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 7) Now you are ready to begin the actual Node.J S and NPM Package Manager installation process. Click [Install] to begin; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 8) Now you will get the standard Windows warning asking whether you want to allow the NodeJ S app to m ake changes to your device. Click [Yes] to continue with the installation; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 9) The installation process will continue autom atically from this point. Do not attem pt to stop the process or to shut down your m achine; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 10 ) The installation has been com pleted. As long as you see a s u cce s s fu l in s tall m e s s age th e n click [ Fin is h ] . (If any portion failed and y ou get a failure m essage then re-exam ine y our OS and ensure y ou dow nloaded the correct installer for y our m achine. Then install again); file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM How to tell whether Node JS and the NPM (Node Package Manager) was successfully insalled on your Windows machine Ch e ck N o d e JS Ve rs io n n u m be r: 1) Open the Run Window: On a Windows 10 m achine, the fastest way to open a Run Window is to press the Win-key + r. The Win-key is usually to the left of the space bar and the Alt-key and has the Windows icon on it. Press the Win-key and the letter r at the sam e tim e to open the Windows Run window; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 2) Once the Run Window is open, type 'cmd' into the Open feld and the press [OK]; 3) The Windows Com m and Prom pt window will open. (If y ou have never confgured the settings then it will be a plain black screen with white lettering as show n. If y ou have personalized y our com m and prom pt w indow then it could look diferent from this); file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM Tip: Once the command prompt window is open you can right-click the icon in the system bar (at the bottom of the screen) and select 'Pin to Taskbar' so that all you have to do is click the icon in the future to open a command prompt window; file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 4) In the Windows Com m and Prom pt window type 'node -v' followed by the [Enter] key. If you get an error then NodeJ S installation was not successful. Try the process again and m ake sure to follow all the steps exactly. If a ve rs io n n u m be r is re tu rn e d , e xam p le : v10 .6 .0 , th e n th is in d icate s th at yo u h ave s u cce s s fu lly in s talle d N o d e JS. Ch e ck N o d e Package Man age r ( N PM) Ve rs io n n u m be r: file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM 5) In the Windows Com m and Prom pt window type 'npm -v' followed by the [Enter] key. If you get an error then NPM installation was not successful. Try the process again and m ake sure to follow all the steps exactly. If a ve rs io n n u m be r is re tu rn e d , e xam p le : 6 .1.0 , th e n th is in d icate s th at yo u h ave s u cce s s fu lly in s talle d N PM ( N o d e Package Man age r) . What are the various command available in the Windows Command Prompt Tool? Sim plyAdvanced.net provides this really great Cheat Sheet for the Windows Com m and Prom pt. To ge t yo u s tarte d , h e re 's a s h o rt lis t o f th e bas ics ; cd = change directory cd .. = m ove up 1 directory directory cd\ = m ove to the root dir = list the contents of current directory dir / w / p *.* = display contents 1 screen at a tim e exit = close the com m and prom pt file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM m kdir x = create a new directory x Daniel J. LeBlanc I build websites that search engines love. Well experienced web developer and digital marketing author. Technical search engine optimization is my passion and my specialty. Read More — Developing an Organic Web Channel — Web Development What Are the Bes Mobile Responsive Website Templates in 2018? Getting Started with Facebook Augmented Reality Studio Decoding Responsive Web Design See all 20 poss → file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM] Getting Started with Node.JS and Node Package Manager NPM WEB DEVELOPMENT What Are the Bes Mobile Responsive Website Templates in 2018? Mobile responsive website design has becom e a critical factor to the success of all organic websites. The num ber of m obile Internet users is growing and m any analysts are predicting that within the next year or two we will surpass the 70% mark for the percentage of mobile Internet trafc. 23 MIN READ DIGITAL MARKETING NEWS Getting Started with Facebook Augmented Reality Studio Facebook is launching a new tool for developers called 'AR Studio'. This tool allows developers to create augm ented reality tools for building Facebook apps and AR advertising. Here's m y easy-tofollow instructions for getting started. 5 MIN READ Developing an Organic Web Channel © 2018 Lates Poss Facebook Twitter Ghos file:///C/...rsion%20of%20the%20page/Getting%20Started%20with%20Node.JS%20and%20Node%20Package%20Manager%20NPM.html[7/21/2018 11:38:49 AM]