我正在学习gulp,并写下我的第一个任务。我完成了这个任务:
gulp.task('js-libs', function () {
return gulp.src([
// Add JavaScript Files here
'./node_modules/jquery/dist/jquery.min.js'
])
// Output for Angular Files
.pipe(gulp.dest('./dist/js/'))
.on('error', js-libs.logError);
});
当我运行它时,我在终端中收到此错误:
$ gulp js-libs
[01:02:41] Using gulpfile ~\PhpstormProjects\xxx\gulpfile.js
[01:02:41] Starting 'js-libs'...
[01:02:41] 'js-libs' errored after 7.28 ms
[01:02:41] ReferenceError: js is not defined
at Gulp.<anonymous> (C:\Users\xxx\PhpstormProjects\xxx\gulp\javascript.js:27:22)
at module.exports (C:\Users\xxx\PhpstormProjects\xxx\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (C:\Users\xxx\PhpstormProjects\xxx\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (C:\Users\xxx\PhpstormProjects\xxx\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (C:\Users\xxx\PhpstormProjects\xxx\node_modules\gulp\node_modules\orchestrator\index.js:134:8)
at C:\Users\xxx\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
at nextTickCallbackWith0Args (node.js:420:9)
at process._tickCallback (node.js:349:13)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
所以现在是个大问题......出了什么问题?该脚本工作正确...它采取js文件并将它们放在我想要的地方。但为什么我收到此错误消息?
答案 0 :(得分:0)
根据您发布的剪辑,错误消息显示行和确切的错误:
js-libs.logError
这是在寻找一个名为js
的变量,并试图减去libs.logError
。