How do I install gulp 4

后端 未结 11 1153
慢半拍i
慢半拍i 2020-12-30 18:32

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

11条回答
  •  再見小時候
    2020-12-30 19:05

    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=
    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!

提交回复
热议问题