How To Install and Use Gulp.js on AlmaLinux 8

In this article, we want to teach you How To Install and Use Gulp.js on AlmaLinux 8.

Gulp is yet another tool from the open-source community to automate repetitive tasks in web development. While tools like bower, npm (Node Package Manager) help us to download and configure re-usable packages in our application, Gulp helps us to automate many of the time-consuming repetitive client-side tasks.

It is built upon Node.js and it already has a strong community that builds various plugins for performing various tasks.

How To Install and Use Gulp.js on AlmaLinux 8

Before you start to install Gulp.js, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with AlmaLinux 8.

Now you can follow the steps below to set up Gulp.js on your server.

Install Node.js on AlmaLinux 8

To install Gulp.js you need to have Node.js installed on your server. First, update your local package index with the following command:

sudo dnf update -y

Then, use the curl command to download the Node.js source:

sudo curl -fsSL | sudo bash -

Next, install Node.js on AlmaLinux 8 with the following command:

sudo dnf install nodejs

You can verify your Node.js installation by checking its version:

node -v

When you installed Node.js, it automatically installed NPM as well. To verify the version and build, you can also use the following command:

npm -v

Install Gulp.js on AlmaLinux 8

First, you need to install the Gulp CLI tool, which is used to work with and manage your Gulp.js application.

npm install -g gulp-cli

Then, create a directory for your Gulp application and switch to it with the following command:

sudo mkdir gulp-directory && cd gulp-directory

Now you need to create a new application with the npm command:

sudo npm init

Provide some information or Press Enter to create a package.json file.

package name: (gulp-project) 
version: (1.0.0) 
entry point: (index.js) 
test command: 
git repository: 
license: (ISC) 
About to write to /root/gulp-project/package.json: 
"name": "gulp-project", 
"version": "1.0.0", 
"description": "", 
"main": "index.js", 
"scripts": { 
     "test": "echo \"Error: no test specified\" && exit 1" 
"author": "", 
"license": "ISC" 
Is this OK? (yes) yes

When it is completed, you need to install the Gulp module with the following command:

sudo npm install --save-dev gulp

Verify your Gulp.js installation on AlmaLinux 8 by checking its version:

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

How To Use Gulp.js

At this point, we want to show you the basic usage of Gulp.js by creating a sample application.

First, switch to your Gulp directory:

cd gulp-directory

Then, create a gulpfile.js with your favorite text editor, here we use vi:

sudo vi gulpfile.js

Add the following content to your file:

var gulp = require('gulp');
gulp.task('hello', function(done) {
console.log('Hello World!!!');

When you are done, save and close the file.

Next, run the Gulp task with the command below:

gulp hello

In your output you will see:

[22:49:40] Using gulpfile /home/joshua/gulp-directory/gulpfile.js
[22:49:40] Starting 'hello'...
Hello World!!!
[22:49:40] Finished 'hello' after 1.21 ms


At this point, you learn to Install and Use Gulp.js on AlmaLinux 8.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!