How do I install gulp 4

2020-02-26 02:27发布

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 available via the npm repo. npm info gulp dist-tags returns: { latest: '3.9.0' }.

I can see that there is a 4.0 branch within the git repo. But attempting to install it with variations on this command fails: npm install https://github.com/gulpjs/gulp#v4.0.0.

10条回答
Fickle 薄情
2楼-- · 2020-02-26 03:06

As of December 28th 2018, the following command should work perfectly fine in installing version 4 locally.

npm i -D gulp
查看更多
干净又极端
3楼-- · 2020-02-26 03:07

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

查看更多
冷血范
4楼-- · 2020-02-26 03:07

November 2018 » npm audit says to run: npm install --save-dev gulp@4.0.0

查看更多
虎瘦雄心在
5楼-- · 2020-02-26 03:10
npm install gulpjs/gulp.git#4.0 --save-dev
查看更多
ら.Afraid
6楼-- · 2020-02-26 03:11

to install gulp-4, CLI version has to be 1.2.2 which will support gulp 4.0

to install gulp-cli 1.2.2 run sudo npm install gulp-cli@1.2.2 -g

and to install gulp 4.0 run npm install 'gulpjs/gulp.git#4.0' --save-dev

when you run gulp -v command

you should get

[11:38:36] CLI version 1.2.2

[11:38:36] Local version 4.0.0-alpha.2

similar issue on GitHub

查看更多
爷、活的狠高调
7楼-- · 2020-02-26 03:16
# 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

查看更多
登录 后发表回答