How to Install Bower on Ubuntu 22.04 & 20.04

Bower is a package manager for front-end development that allows you to manage your dependencies and includes features like versioning, downloading from GitHub, and more. It’s popular among web developers because it makes managing project dependencies easy and efficient.

In this tutorial, we’ll show you how to install Bower on Ubuntu 22.04. We’ll also show you how to use it to install packages and manage your dependencies. Let’s get started!

Step 1 – Installing Node.js

Node.js is the primary requirement for running Angular applications. You can install the required Node.js using NVM command-line utility. Log in to your Ubuntu system and follow:

  1. Use the following command to install NVM:
    curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash 
    
  2. Now activate the NVM enviornemnt on your system.
    source ~/.bashrc
    
  3. As of today, Angular 14 is the latest version that suport Node.js 14 LTS and 16 LTS versions. Following command will install Node.js 16 on your system.
    nvm install v16
    

Step 2 – Installing Bower on Ubuntu

After installation of node.js and npm on your system, use the following commands to install bower.

npm install bower  --location=global  

Now, You have successfully installed the bower. Let’s check the installed version of the bower on your system using the following command.

bower --version 
Output
1.8.14

Step 3 – Using Bower in Applicaiton

As you are already aware that Bower is a package management utility. It stores the details of the package under bower.json file.

Here are the quick references for using bower:

  • The following command creates a bower.json file for your package with bower init.
    bower init 
    
  • To Install all packages defined under bower.josn file, run below command:
    bower install 
    
  • Search for a specific package
    bower search phpmailer
    
  • This command will install defined package and save the reference in bower.json.
    bower install phpmailer --save 
    
  • Installing bower package from Github repository.
    bower install git://github.com/user/package.git 
    
  • Installing bower package from a URL.
    bower install http://example.com/script.js 
    

Conclusion

In conclusion, this article has shown you how to install the Bower on Ubuntu 22.04. If you run into any problems or have any questions, please leave a comment below and I will do my best to help you out. Thanks for reading!

The post How to Install Bower on Ubuntu 22.04 & 20.04 appeared first on TecAdmin.

Bower node Nodejs TecAdmin