I\'ve been using gulp-watch. The current version of gulp-watch relies on the call gulp.parrallel. This call is only available from gulp 4.
However gulp 4 is not avai
# 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
November 2018 » npm audit says to run: npm install --save-dev gulp@4.0.0
I wrote a batch file that does the job based on what @demisx answered.
The problem I had was a missing npm config parameter 'prefix', so my global directory was the node binary directory. I am pretty sure this wasn't always the case, but I could (re-)set it running this script from the project root directory:
@ECHO OFF
echo configuring npm
set USERNAME=<enter username>
set USERPROFILE=C:\Users\%USERNAME%
set APPDATA=%USERPROFILE%\AppData\Roaming
call npm config set prefix %APPDATA%\npm
SET DIR_PROJECT="D:/stuff/plugins/wallpaper_engine/raintime-dev"
echo Uninstall previous Gulp installation and related packages, if any
call npm rm gulp -g
call npm rm gulp-cli -g
echo cd %DIR_PROJECT%
cd /D %DIR_PROJECT%
call npm rm gulp --save-dev
call npm rm gulp --save
call npm rm gulp --save-optional
call npm cache clean
echo Install the latest Gulp CLI tools globally
call npm install gulpjs/gulp-cli -g
echo Install Gulp 4 into your project from 4.0 GitHub branch as dev dependency
rem call npm install gulpjs/gulp#4.0 --save-dev
call npm install gulpjs/gulp --save-dev
echo Check the versions installed.
call gulp -v
pause
The script finally showed this:
[14:59:48] CLI version 2.0.1
[14:59:48] Local version 4.0.0
Hope it helps!
My installation was a bit different.
Running
npm install 'gulpjs/gulp.git#4.0' --save-dev
Or
npm install 'gulpjs/gulp#4.0' --save-dev
Gave me an error:
npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name "gulp#4.0": Tags may not have any characters that encodeURIComponent encodes.
NB I was only having problems installing my local gulp-4 so I took a look at my last package.json
installation and saw this:
"gulp": "github:gulpjs/gulp#4.0",
So my move was to install local gulp with
npm install "github:gulpjs/gulp#4.0" --save-dev
and that worked, installing local gulp 4 successfully.
[15:45:55] CLI version 1.4.0
[15:45:55] Local version 4.0.0-alpha.2
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
Windows still wouldn't upgrade. The below commands from another Linux post seemed to clear it out, and afterwards success.
Can't seem to upgrade gulp to 4.0 from 3.9
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