Gulp jquery-ui 上的 wiredep 错误

Gulp wiredep error on jquery-ui

我使用 wiredep 获取所有供应商组件并将它们放在一个临时文件夹中,但是当我添加 jquery-ui 时,wiredep 失败。

gulpfile.js

gulp.task('build:vendor', ['cleanVendor'], function () {
    var files = require('wiredep')();
    var stream = gulp.src(files.js);
    // ...other code here
});

错误输出:

C:\Dev\node_modules\wiredep\wiredep.js:30
    ('on-error', opts.onError || function(err) { throw new Error(err); })
                                                       ^
Error: Error: jquery-ui is not installed. Try running `bower install` or remove
the component from your bower.json file.
    at C:\Dev\node_modules\wiredep\wiredep.js:30:56
    at C:\Dev\node_modules\wiredep\lib\detect-dependencis.js:149:29
    at forOwn (C:\Dev\node_modules\wiredep\node_modules\lodash\dist\lodash.js:2106:15)
    at Function.forEach (C:\Dev\node_modules\wiredep\node_modules\lodash\dist\lodash.js:3303:9)
    at detectDependencies (C:\Dev\node_modules\wiredep\lib\detect-dependencies.js:34:7)
    at wiredep (C:\Dev\node_modules\wiredep\wiredep.js:70:39)
    at Object.<anonymous> (C:\Dev\gulp\prep.js:16:33)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

bower.json:

{
  "name": "project",
  "version": "0.0.1",
  "dependencies": {
    "angular-messages": "^1.4.2",
    "angular-aria": "^1.4.2",
    "jquery": "^1.11.3",
    "angular": "^1.4.2",
    "jquery-ui": "1.11.4"
  }
}

我尝试在 bower.json 文件中添加覆盖,但结果是一样的。

奇怪的是,这在节点 shell 中有效。 其他可能有用的信息:

发现我的错误,

gulp.task('build:vendor', ['cleanVendor'], function () {
    var files = require('wiredep')();
    var stream = gulp.src(files.js);
    // ...other code here
});

应该是:

gulp.task('build:vendor', ['cleanVendor'], function () {
    var files = require('wiredep')({ directory: 'bowerDirectoryHere'});
    var stream = gulp.src(files.js);
    // ...other code here
});

默认值(我不确定它是从哪里提取的)级别太高了。奇怪的是它只在 jquery-ui 而不是 angular 或其他

上失败。