Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Gulp.js on Ubuntu 20.04 - DesignLinux

Jun 22 2021
designlinux 0 Comments
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.

Related

Tags: gulp, ubuntu

How to Install FFmpeg in Linux

Prev Post

How to Use Port Knocking To Secure SSH Service in Linux

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 2
  • 674
  • 610,033

DesignLinux.com © All rights reserved

Go to mobile version