1

我使用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 文件添加覆盖,但结果是一样的。

奇怪的是,这适用于节点外壳。其他可能有用的信息:

  • 视觉工作室 2015
  • NodeJS 版本:0.12.2
  • 吞咽版本:3.9.0
  • wiredep 版本:2.2.2、3.0.0-beta(都试过了)
4

1 回答 1

1

发现我的错误,

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 或其他。

于 2015-11-17T06:35:53.367 回答