gulp-“cli"是什么意思?代表? [英] what does gulp-"cli" stands for?

查看:29
本文介绍了gulp-“cli"是什么意思?代表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能解释一下以下两种 gulp 安装方法的区别:

Can someone please explain what exactly are the differences between the following two methods of gulp installation:

$ npm install --global gulp-cli

$ sudo npm install -g gulp 

在我看来,除了第一种方法给我一个 1.2.1 版本,而后者给我 3.9.1 版本之外,两者都做同样的事情

It looks to me that both do the same thing except that the first method gives me a version 1.2.1, and the later gives me version 3.9.1

有人能简单地说一下到底有什么区别吗?还有cli"代表什么?

Can someone put into simple terms what exactly are the differences? and plus what is "cli" stands for?

推荐答案

gulp-cli 的目标是让你像使用全局程序一样使用 gulp,但无需全局安装 gulp.

The goal of gulp-cli is to let you use gulp like a global program, but without installing gulp globally.

例如,如果您在全局安装了 gulp 3.9.1,并且您的项目 testGulp4 在本地安装了 gulp 4.0,如果您在 testGulp4 中运行 gulp -v 会发生什么?

For example if you installed gulp 3.9.1 globally and your project testGulp4 has gulp 4.0 installed locally, what would happen if you run gulp -v into testGulp4?

  • 没有全局安装 gulp-cli:

  • Without gulp-cli globally installed :

CLI version 3.9.1

在这种情况下,显示的版本是 gulp 的全局版本.本地版本 4.0 完全被忽略.

In this case the version displayed is the global version of gulp. The local version 4.0 is totally ignored.

全局安装 gulp-cli:

With gulp-cli globally installed :

CLI version 1.2.1
Local version 4.0.0-alpha.2

在这种情况下,显示的版本是 gulp-cli 的全局版本和 gulp 的本地版本.全局 gulp 3.9.1 完全被忽略了.

In this case the version displayed is the global version of gulp-cli and the local version of gulp. The global gulp 3.9.1 is totally ignored.

结论:

  • gulp-cli: 是首选,因为它允许您使用不同版本的 gulp.
  • gulp:需要安装本地版本的 gulp.

这篇关于gulp-“cli"是什么意思?代表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆