Tutorial Install Gulp.js On Ubuntu 18.04
Gulp is a toolkit that helps developers with the automation of painful workflow during development. To install Gulp you first need to install Node.js, so you will start by installing Node.js on your Ubuntu by following the instructions below and then install Gulp.
Gulp.js Vs. Other Task runners
The main reason that Gulp is different is that it uses Node streams. Since gulp pipes output from one task as an input to the next, it reads the file once and then processes it through multiple tasks. Gulp will finally write the output file. So, gulp is faster because there is no need to create and read intermediary files on the hard drive.
Prerequisites to install Gulp.js on Ubuntu 18.04
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with Sudo privileges.
To set up, follow our Initial server setup on Ubuntu 18.04.
How to Install Gulp.js On Ubuntu 18.04 LTS
Gulp is a command-line task runner for Node.js. Using Gulp allows you to automate processes and run repetitive tasks with ease. Let’s go through the steps of this guide and install the Gulp.js toolkit on Ubuntu 18. This way of installation is also useful for those who wish to install Gulp.js on Ubuntu 16.04.
First of all, you need to install Nodejs on your system. To add node.js PPA in your Ubuntu system and install it, run:
sudo apt-get install python-software-properties
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install nodejs
Then, you can use the command below to check if it is installed successfully or not:
Once Node.js and Npm are installed, you are ready to install Gulp. So, type:
sudo npm install -g gulp
If all is done correctly, Gulp should be installed now. To check the installed version of bower on your system, use the following command:
In this way, you can view the CLI and Local versions of your current gulp.
To install the gulp command-line utility, run:
npm install --global gulp-cli
How to create a project directory in Gulp.js
At this point, you can create a project directory and navigate into it. To do this, use the following commands:
npx mkdirp my-project
How to create a package.json file in your project directory
To receive your project a name, version, description, etc, you can run the following command and create a package.json file:
Finally, run the following command to install the gulp package in your devDependencies:
npm install --save-dev gulp
In this article, you learned How to Install Gulp.js On Ubuntu 18.04. Gulp helps you to automate numerous tasks in your workflow. You can now Spin up a web server and reload the browser automatically whenever a file is saved. Also, you can refer to a related article and learn How to configure Gulp.js on Ubuntu 20.04.