• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install Gulp.js on Ubuntu 22.04

Written by Admin, Updated On January 12, 2023
gulp, ubuntu
How to Install Gulp.js on Ubuntu 22.04

Gulp.js is an open-source toolkit that helps developers automate the tasks in development workflow. Gulp is useful to make automate processes and run repetitive tasks easily. It also includes the feature of piping output to the another command. This tutorial shows you how to install Gulp.js on Ubuntu 22.04 systems.

Prerequisites#

You must logged in with root or user with sudo privileges.

Step 1 – Update Packages#

At first you we will update the installed packages using below given command:

sudo apt update -y
sudo apt upgrade -y

Step 2 – Install Dependencies#

We need to install build-essential package for ahead installation. Issue the following command:

sudo apt install build-essential -y

Step 3 – Installing Node.js#

Now, we will install Node.js on system. Add the PPA on your Ubuntu and install using the below command list:

sudo apt install python-software-properties
curl -sL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt update
sudo apt install nodejs -y

Verify the installation by typing:

node -v && npm -v
v18.12.1
 7.6.3

Step 3 – Sample Application with NPM#

At this point, you can easily use the Gulp in your existing Node.js applications by installing Gulp package. Here, we will create a sample Node.js application with NPM.

mkdir gulp-project && cd gulp-project
npm init

You will be promted for required information to initialize a new empty project under current directory. Input all required information and at the end it will show you the inputted information and confirm.

About to write to /root/gulp-project/package.json:

{
  "name": "gulp-project",
  "version": "1.0.0",
  "description": "Sample gulp application",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "gulp",
    "app"
  ],
  "author": "TecNStuff",
  "license": "ISC"
}

Is this OK? (yes)

Hit the Enter key to save all the details.

Step 3 – Installing Gulp on Ubuntu#

To install Gulp CLI globally use the below command on your Ubuntu system.

npm install -g gulp-cli

Also you need to install gulp package in your application. Go to your application directory and execute the following command:

npm install --save-dev gulp

That’s it. Check the installed version of Gulp CLI and Gulp Module in your application by typing:

gulp --version
CLI version: 2.3.0
Local version: 4.0.2

Step 4 – Gulp Example#

At this stage, your system have installed gulp-cli and gulp package to your application.

Next, create a gulpfile.js under the application root directory.

Add the following code to the gulp example file.

var gulp = require('gulp');

gulp.task('welcome', function(done) {
  console.log('Welcome!!!');
  done();
});

Save and close your file.

You can run the gulp task by typing:

gulp welcome

The above command will run the gulp task named “welcome”. It will show you the following output on screen.

Using gulpfile ~/gulpfile.js
Starting 'welcome'...
Finished 'welcome' after 04.6 ms

Conclusion#

You successfully learned how to install Gulp.js on your Ubuntu 22.04 system. To learn more visit the official documentation page of Gulp.js.

If you have any questions or suggestion, leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install LibreOffice on Ubuntu 22.04
Next Article   How to Install GIMP on Debian 11

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook