• 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 20.04

Written by Admin, Updated On June 7, 2021
gulp, ubuntu
How to Install Gulp.js on Ubuntu 20.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 20.04 LTS Linux systems.

Prerequisites#

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

Step 1 – Update Packages#

First of all, update the installed packages using following command:

sudo apt update -y
sudo apt upgrade -y

Step 2 – Installing Node.js#

Now, we need to 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_14.x | sudo -E bash -
sudo apt install nodejs -y

Verify the installation by typing:

node -v && npm -v
v15.12.0
 7.6.3

Step 3 – Sample Application with NPM#

At this stage, 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#

Use the below command install Gulp CLI globally 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.2.0
Local version: 4.0.2

Step 4 – Gulp Example#

At this point, 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 42.5 ms

Conclusion#

You successfully learned how to install Gulp.js on your Ubuntu 20.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 Puppet Agent on Ubuntu 20.04
Next Article   [Solved] Unknown collation: utf8mb4_0900_ai_ci

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