How do I install gulp 4

# Uninstall previous Gulp installation and related packages, if any
$ npm rm gulp -g
$ npm rm gulp-cli -g
$ cd [your-project-dir/]
$ npm rm gulp --save-dev
$ npm rm gulp --save
$ npm rm gulp --save-optional
$ npm cache clean # for npm < v5

# Install the latest Gulp CLI tools globally
$ npm install gulpjs/gulp-cli -g

# Install Gulp 4 into your project as dev dependency
$ npm install gulp --save-dev

# Check the versions installed. Make sure your versions are not lower than shown.
$ gulp -v
---
[10:48:35] CLI version 2.0.1
[10:48:35] Local version 4.0.0

Detail info is on this blog page: https://demisx.github.io/gulp4/2015/01/15/install-gulp4.html


Gulp has removed the 4.0 branch from their GitHub repository, so the previous way of installing using npm install gulpjs/gulp.git#4.0 --save-dev no longer works.

They state in their README that the correct way to install gulp 4.0 is to run the command:

npm install gulp@next


npm install gulpjs/gulp.git#4.0 --save-dev

Run the following to check the version of gulp cli that is installed on your machine.

gulp -v

If you are not running version 4, do the following to install gulp globally on your machine.

npm uninstall -g gulp
npm install -g "gulpjs/gulp#4.0"

Now install gulp 4 locally

npm uninstall gulp --save-dev
npm install "gulpjs/gulp#4.0" --save-dev

November 2018 » npm audit says to run: npm install --save-dev [email protected]