In this blog post, I’ll take you through the steps to Install Gulp.js on CentOS / Fedora / Ubuntu and Debian Linux. Gulp is a toolkit that helps you automate painful or time-consuming tasks in your development workflow. Gulp has integrations built into all major IDEs for easy use with PHP, .NET, Node.js, Java e.t.c.

Step 1: Install Node.js

Gulp requires Node to be installed on the hosting system. Ensure it is installed on your system before you proceed to step 2.

See our guide below on the installation of

Confirm the Node.js on the system.

$ node -v
v20.9.0

Also confirm npx installed version.

$ npx --version
10.1.0

Step 2: Install Gulp.js using npm

After installing Node.js, proceed to install Gulp.js using NPM package manager for Node

npm install --global gulp-cli

This will make gulp to be available globally on the system.

Verify your gulp versions:

$ gulp --version
CLI version: 2.3.0
Local version: Unknown

Step 3: Install in your dev Dependencies

To install gulp package in your dev Dependencies, do it like below:

Create a Project directory:

$ npx mkdirp project1
Need to install the following packages:
[email protected]
Ok to proceed? (y) y

Navigate to Project directory and create package.json file

cd project1
npm init

This will guide you through giving your project a name, version, description, etc. Sample output is below:

This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help json` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (project1) 
version: (1.0.0) 
description: My first Project
entry point: (index.js) 
test command: 
git repository: 
keywords: 
author: 
license: (ISC) 
About to write to /home/jmutai/project1/package.json:

{
  "name": "project1",
  "version": "1.0.0",
  "description": "My first Project",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Install the gulp package in your dev Dependencies

npm install --save-dev gulp

Check gulp versions:

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

Create a gulpfile

Create a file named gulpfile.js in your project root:

vim gulpfile.js

Add these contents:

function defaultTask(cb) {
  // place code for your default task here
  cb();
}

exports.default = defaultTask

Test by running the gulp command in your project directory:

$ gulp
[02:41:28] Using gulpfile ~/project1/gulpfile.js
[02:41:28] Starting 'default'...
[02:41:28] Finished 'default' after 3.9 ms

To run multiple tasks, you can use gulp <task> <othertask>.

LEAVE A REPLY

Please enter your comment!
Please enter your name here