
This was the best way to install the nodejs and npm. Sudo apt-get update sudo apt-get install nodejs sudo apt-get install npm
Open the terminal and run the following commands to install nodejs and npm in Linux. To update the version of npm/node you can run the following command. That is it! You have your node and np[m installed. This should print npm’s version number like 4.6.1
Test npm: To see if npm is installed, Open the Windows Command Prompt, Powershell or a similar command line tool, and type. This should print a version number something like v6.9.5. Test Node: Open the Windows Command Prompt, Powershell or a similar command line tool, and type. You won’t be able to run Node.js until you restart your computer. Download the Windows installer from the Nodes.js website. There are many different operating systems available in the world but we are covering Ubuntu and Windows to install node and npm in this example, If you have a Mac machine then please visit Latest Guide to Install npm and node js in Mac OS. Install npm and node js for Ubuntu and Windows So to make our life easy let’s start installing npm. It also makes collaboration and sharing more difficult. However, as your project and list of dependencies grows, this will quickly become time-consuming and messy. It is definitely possible to manually download your libraries, copy them into the correct directories, and use them that way. On top of this, it is also possible to specify what versions your project depends upon to prevent updates from breaking your project. Which means you can specify your project’s dependencies in the package.json file and any time you or anyone else needs to get started with your project they can just need to run npm install which will install all the dependencies in the node_module directory. Whenever you work with npm/node you can see it manages a file called package.json in which it stores all the dependency you have used in your project under the dependency section. The main goal, as you touched upon, is the automated dependency and package management. Although it does create some of your directory structure/organization, this is not the main purpose.