Posted in NodeJS

NodeJS Series #5: Installing,Uninstalling,Updating Modules

Hi Wizards,

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.

MODULES

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:

node8

Now open your Nodejs Command Prompt and head to the folder you just created.

node9

Now add these lines to install browserify in the specified folder:

npm install browserify

Press Enter and let it download dependencies and browserify module itself.

node10
Once its finished,you can have a look at your folder structure being replaced by browserify module and its dependencies.

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

node11

And it will uninstall browserify and its dependencies.

node12

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:

node13

We talked about a great deal managing modules in this post.Hope it was useful information for you,Wizards 🙂

See you next time.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s