尝试运行时Gulp服务器问题

时间:2014-04-13 02:52:37

标签: ubuntu gulp gulp-karma

我在尝试运行项目时似乎遇到了一个奇怪的错误,它似乎在mac中正常工作,但我无法在Windows / ubuntu中运行

/home/nicholas/Desktop/Workspace/projectx/node_modules/gulp/node_modules/orchestrator/index.js:47
            throw new Error('Task '+name+' can\'t support dependencies that is not an a
                  ^
Error: Task connect can't support dependencies that is not an array of strings
    at Gulp.Orchestrator.add (/home/nicholas/Desktop/Workspace/projectx/node_modules/gulp/node_modules/orchestrator/index.js:47:10)
    at Object.<anonymous> (/home/nicholas/Desktop/Workspace/projectx/Gulpfile.js:66:6)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:62:18)
    at Liftoff.launch (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:144:6)

1 个答案:

答案 0 :(得分:13)

看起来您正在尝试设置一个名为'connect'的任务,并且您将第二个参数设置为除字符串数组或函数之外的其他内容。

即,你有这个:

gulp.task('connect', 'some-other-task', function() {
    //...
});

但是,它只能是这样:

gulp.task('connect', ['some-other-task'], function() {
    //...
});

差异的原因很可能是gulp(或者更确切地说,Orchestrator)在Windows计算机上更新,但在Mac上没有。如果从两台计算机上的目录中运行npm list,它应该显示当前安装的版本。如果您在Mac上运行npm up,则很可能与其他计算机具有相同的错误。