Do you remember what we did previously? We created a Port Listener which listens to a port and get response.
In that post, we used a module named “http” to send request and get response.
Now im gonna talk about “Modules” and how to use them.
Node Package Manager consists of many modules that can be downloaded and used in your project.The list of repository can be accessed from: https://www.npmjs.com/
You can however specify if a module will be used local or global.
What does that mean?
Global means it can be used in other projects as well.But by default,Local mode is preferred.
Note: you can install a module globally by adding “-g” parameter.
Important Note:Before installing a module,make sure you create a folder in a near destination.I will be using a test folder in my desktop.
Installing a Module
Installing a module is easy,lets get back to https://www.npmjs.com/ and select a module to install browserify:
Now open your Nodejs Command Prompt and head to the folder you just created.
Now add these lines to install browserify in the specified folder:
npm install browserify
UnInstalling a Module
Since we installed Browserify,why dont we use the same module?
To Uninstall a module you simply,write this command:
npm uninstall browserify
And it will uninstall browserify and its dependencies.
You shall see in your project folder that the modules are gone.
Updating a Module
Why do we even update? To get the latest version of course!
If you previously used an older module with new version available,you’ll desire to update it in no time.
To Update a module you simply write this command:
npm update browserify
Rest is up to NPM.It will update the specified module.Since we uninstalled the browserify module previously however you can test it after you install it again:
We talked about a great deal managing modules in this post.Hope it was useful information for you,Wizards 🙂
See you next time.