未能在WebStorm 2016.1中列出吞噬任务 [英] Failed to list gulp tasks in WebStorm 2016.1

查看:468
本文介绍了未能在WebStorm 2016.1中列出吞噬任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Gulp 3.9.1,节点5.7.1,npm 3.10.3和WebStorm 2016.1。当我尝试为我的项目设置gulp时,出现以下错误:

  / usr / local / bin / node / Users /msbauer/Developer/workspaces/provider-data-management/node_modules/gulp/bin/gulp.js --color --gulpfile /Users/msbauer/Developer/workspaces/provider-data-management/gulpfile.js 

错误:未知选项`--color'


处理完成退出代码1

当我强制重新扫描任务时:

 无法在提供程序中列出gulp任务 - data-management / gulpfile.js:进程完成退出代码1(非零退出代码表示错误)
*编辑设置

$ / usr / local / bin / node / Users / msbauer / Developer / workspaces / provider-data-management / node_modules / gulp / bin / gulp.js --no-color --gulpfile /Users/msbauer/Developer/workspaces/provider-data-management/gulpfile.js - 任务

错误:未知选项` - 无颜色'


完成退出代码1

当我在CLI执行 gulp --help 时:



<$ p $使用:gulp [options] [command]


命令:
$ b $ gulp --help

$ b显示有关availity-workflow项目的版本信息
init初始化项目元数据:package.json,bower.json,availity.json和README.md

选项:

-h,--help输出使用信息
-V,--version输出版本号

这就好像WebStorm正在增加额外的参数一样,但是我的gulp版本不支持这些参数。

更新:



我运行以下命令来安装gulp-cli(第二个来自我的项目根目录):

  $ brew install gulp-cli 
$ npm install -g gulp-cli

如果我做了 gulp --help 我可以选择正确的选项:

  $ gulp  - 帮助

用法:gulp [options]任务

选项:
--help,-h显示此帮助。 [boolean]
--version,-v打印全局和本地gulp版本。 [boolean]
--require在运行gulpfile之前需要一个模块。这是
对转译器有用,但也有其他应用程序。
[string]
--gulpfile手动设置gulpfile的路径。如果您有多个
的纸币,这很有用。这将把CWD设置为
的gulpfile目录。 [string]
--cwd手动设置CWD。搜索gulpfile以及
所有需求的相关性将从这里开始。 [字符串]
--verify将验证项目的package.json中引用的插件
对插件黑名单。
--tasks,-T打印加载的gulp文件的任务依赖关系树。
[boolean]
--depth指定任务依赖关系树的深度。
--tasks-simple为加载的gulp文件输出任务的纯文本列表。
[boolean]
--tasks-json打印JSON格式的任务依赖关系树,用于
加载的gulp文件。
--color即使在检测到
没有颜色支持的情况下,也会强制gulp和gulp插件显示颜色。 [boolean]
--no-color将强制gulp和gulp插件不显示颜色,甚至在检测到颜色支持时为
。 [boolean]
--silent,-S禁止所有的吞噬日志。 [boolean]
- 继续失败时继续执行任务。 [boolean]
--log-level,-L设置日志级别。 -L最简单,-LLLL最多
详细。 -LLL是默认值。 [count]

其中返回路径 /用户/我/开发商/自制软件/斌/一饮而尽。但是,如果我运行 gulp --color ,我仍然收到错误错误:未知选项 - color'`

如果我使用〜/ Developer / workspace / project / node_modules / gulp-cli / bin / gulp.js的gulp路径进行相同的实验, -help (再次,从CLI)我得到完全相同的结果: --help 输出正确的选项,但是 --color - no-color 失败,并且出现相同错误,尽管被列为有效选项。

解决方案

我刚才遇到了同样的问题。我追踪到我们的应用程序的一部分,使用commander.js创建自定义CLI。我能够告诉指挥官传递所需的选项。我将不得不发送pull请求,而不是破解node_modules版本。



项目 gulpfile.js:

  var cli = require('custom-cli'); 

Project \\\
ode_modules\custom-cli\cli\ index.js

  var program = require('commander'); 

program.version(manifests.package.json.version);

// WebStorm需要通过这些选项来吞噬,因此指挥官必须知道它们
program.option(' - no-color','Disable Colors');
program.option(' - gulpfile','gulpfile');


I am using Gulp 3.9.1, node 5.7.1, npm 3.10.3, and WebStorm 2016.1. When I try to setup gulp for my project, I get the following error:

/usr/local/bin/node /Users/msbauer/Developer/workspaces/provider-data-management/node_modules/gulp/bin/gulp.js --color --gulpfile /Users/msbauer/Developer/workspaces/provider-data-management/gulpfile.js

  error: unknown option `--color'


Process finished with exit code 1

And when I force to rescan tasks:

Failed to list gulp tasks in provider-data-management/gulpfile.js: process finished with exit code 1 (a non-zero exit code means an error)
 * Edit settings

$ /usr/local/bin/node /Users/msbauer/Developer/workspaces/provider-data-management/node_modules/gulp/bin/gulp.js --no-color --gulpfile /Users/msbauer/Developer/workspaces/provider-data-management/gulpfile.js --tasks

  error: unknown option `--no-color'


Process finished with exit code 1

When I execute gulp --help at CLI:

$ gulp --help

  Usage: gulp [options] [command]


  Commands:

    about   display version information about availity-workflow project
    init    initialize project metadata: package.json, bower.json, availity.json and README.md

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

It's almost as if WebStorm is tacking on extra params, but the version of gulp I have doesn't support said params.

Updated:

I ran the following to installed gulp-cli (the second from my project root):

$ brew install gulp-cli
$ npm install -g gulp-cli

If I do gulp --help I get the right options:

$ gulp --help

Usage: gulp [options] tasks

Options:
  --help, -h       Show this help.                                     [boolean]
  --version, -v    Print the global and local gulp versions.           [boolean]
  --require        Will require a module before running the gulpfile. This is
                   useful for transpilers but also has other applications.
                                                                        [string]
  --gulpfile       Manually set path of gulpfile. Useful if you have multiple
                   gulpfiles. This will set the CWD to the gulpfile directory as
                   well.                                                [string]
  --cwd            Manually set the CWD. The search for the gulpfile, as well as
                   the relativity of all requires will be from here.    [string]
  --verify         Will verify plugins referenced in project's package.json
                   against the plugins blacklist.
  --tasks, -T      Print the task dependency tree for the loaded gulpfile.
                                                                       [boolean]
  --depth          Specify the depth of the task dependency tree.
  --tasks-simple   Print a plaintext list of tasks for the loaded gulpfile.
                                                                       [boolean]
  --tasks-json     Print the task dependency tree, in JSON format, for the
                   loaded gulpfile.
  --color          Will force gulp and gulp plugins to display colors, even when
                   no color support is detected.                       [boolean]
  --no-color       Will force gulp and gulp plugins to not display colors, even
                   when color support is detected.                     [boolean]
  --silent, -S     Suppress all gulp logging.                          [boolean]
  --continue       Continue execution of tasks upon failure.           [boolean]
  --log-level, -L  Set the loglevel. -L for least verbose and -LLLL for most
                   verbose. -LLL is default.                             [count]

which returns the path /Users/me/Developer/homebrew/bin/gulp. But if I run gulp --color I still get the error error: unknown option--color'`

If I do the same experiment using the gulp path of ~/Developer/workspace/project/node_modules/gulp-cli/bin/gulp.js --help(again, from CLI) I get the exact same results: --help outputs the correct options, but --color and --no-color fails with the same error, despite being listed as valid options.

解决方案

I ran into this same issue just now. I tracked it down to a part of our app creating a custom CLI using commander.js. I was able to tell commander to pass along the options needed. I will have to send a pull request over instead of hacking up the node_modules version.

project gulpfile.js:

var cli = require('custom-cli');

Project\node_modules\custom-cli\cli\index.js

var program = require('commander');

program.version(manifests.package.json.version);

//WebStorm needs to pass these options to gulp, so commander has to know about them
program.option('--no-color', 'Disable Colors');
program.option('--gulpfile', 'gulpfile');

这篇关于未能在WebStorm 2016.1中列出吞噬任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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