Problem scenario
You want to use Gulp the automation tool (https://gulpjs.com/). How do you install it and get it to work on Linux (either a Debian distribution or a Red Hat distribution)?
Solution
1. If you are using CentOS, Red Hat Enterprise Linux, or Fedora, run these two commands:
sudo yum -y install nodejs npm # *
sudo npm install -g gulp
If you are using Debian or Ubuntu Linux, run this command: sudo apt-get -y install nodejs npm gulp # *
* If you need assistance installing Node.js and npm on a different distribution of Linux, see this posting.
2.a. Run this commmand: sudo npm init
2.b. # Respond with whatever you think is best. You can press enter to these six prompts:
name: (jdoe)
version: (1.0.0)
git repository:
keywords:
author:
license:
2.c. For the "Is this ok?" prompt, choose "yes".
3 Run this command: sudo npm install --save-dev gulp
4. Create a file called Gulpfile.js with this as the content (the top line starts with "var gulp..."):
var gulp = require('gulp');
gulp.task('default', function() {
// place code for your default task here
});
5. Run the command: gulp
You should see this:
[12:46:49] Using gulpfile ~/Gulpfile.js
[12:46:49] Starting 'default'...
[12:46:49] Finished 'default' after 125 µs
6. You can use this command to see what version of Gulp is installed: gulp -v