Atlantic.Net Blog

How to Install Gulp.js on Rocky Linux 8

Gulp is a free, open-source, cross-platform JavaScript tool that helps you automate time-consuming tasks in your development workflow. It is built on Node.js and NPM used to reduce the amount of development time and attention required for tasks such as modification and optimization. It helps developers to run front-end tasks and large-scale web applications.

In this post, we will show you how to install Gulp.js on Rocky Linux 8.

Step 1 – Install Node.js on Rocky Linux 8

Gulp is based on Node.js and NPM, so you will need to install both packages to your system.

First, install the curl package with the following command:

dnf install curl -y

Next, add the Node source repository using the following command:

curl --silent --location https://rpm.nodesource.com/setup_18.x | bash -

Next, install the Node.js package with the following command:

dnf install nodejs -y

Once Node.js is installed, verify the Node.js version with the following command:

node -v

Sample output:

v18.19.0

You can also verify the NPM version using the following command:

npm -v

Sample output:

10.2.3

Step 2 – Install Gulp.js

First, you will need to install the Gulp CLI tool in your system. It is used to install and manage the Gulp application.

You can install the Gulp CLI tool using the following command:

npm install -g gulp-cli

After the installation, create a directory for the Gulp application:

mkdir gulp

Next, change the directory to gulp and create a gulp application with the following command:

cd gulp
npm init

You will be asked to provide several questions for your new application:

package name: (gulp) 
version: (1.0.0) 
description: 
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /root/gulp/package.json:

{
  "name": "gulp",
  "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

Next, run the following command to install the Gulp module:

npm install --save-dev gulp

Next, verify the Gulp installation using the following command:

gulp --version

You should see the following output:

CLI version: 2.3.0
Local version: 4.0.2

Step 3 – Create a Gulp Application

At this point, Gulp is installed. Now, let’s create a sample Gulp application.

First, create a project directory using the following command:

mkdir project

Next, change the directory to project and create a Gulp application with the following command:

cd project
nano gulpfile.js

Add the following code:

var gulp = require('gulp');

gulp.task('hello', function(done) {
  console.log('Hello World Application!!!');
  done();
});

Save and close the file, then run the Gulp application using the following command:

gulp hello

You will get the following output:

[13:55:46] Using gulpfile ~/gulp/project/gulpfile.js
[13:55:46] Starting 'hello'...
Hello World Application!!!
[13:55:46] Finished 'hello' after 3.69 ms

Conclusion

Congratulations! You have successfully installed Gulp.js on Rocky Linux 8. You can now use Gulp to automate repetitive tasks on your virtual private server with ease. For more information, visit the Gulp.js official documentation page.

Get a $250 Credit and Access to Our Free Tier!

Free Tier includes:
G3.2GB Cloud VPS a Free to Use for One Year
50 GB of Block Storage Free to Use for One Year
50 GB of Snapshots Free to Use for One Year