Gulp Browserify ReferenceError: source is not defined
Gulp Browserify ReferenceError: source is not defined
我收到这个奇怪的错误作为标题。
完整消息如下所示
$ gulp browserify [01:21:03] Using gulpfile F:\CSC
Assignments\FinalProject\HotelProject\gulpfile.js [01:21:03] Starting
'browserify'... [01:21:03] 'browserify' errored after 15 ms [01:21:03]
ReferenceError: source is not defined
at Gulp. (F:\CSC Assignments\FinalProject\HotelProject\gulpfile.js:109:15)
at module.exports (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7)
at Gulp.Orchestrator._runTask (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:273:3)
at Gulp.Orchestrator._runStep (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:214:10)
at Gulp.Orchestrator.start (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:134:8)
at C:\Users\LUCKYLAM\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
我是新手,在花了几个小时找出导致问题的原因后,我不知道这里出了什么问题。请帮忙。
这是我的 /app/js/script.js
require('angular');
var app = angular.module('app', []);
gulpfile.js:
gulp.task('browserify', function() {
return browserify('./app/js/script.js')
.bundle()
.pipe(source('main.js'))
// saves it the public/js/ directory
.pipe(gulp.dest('./dist/js/kk/'));
});
我的文件夹结构
我猜你错过了一个 npm package: vinyl-source-stream
.
尝试使用 npm install vinyl-source-stream --save-dev
安装它并在你的 gulpfile.js 中像这样要求:
var source = require('vinyl-source-stream');
我收到这个奇怪的错误作为标题。 完整消息如下所示
$ gulp browserify [01:21:03] Using gulpfile F:\CSC Assignments\FinalProject\HotelProject\gulpfile.js [01:21:03] Starting 'browserify'... [01:21:03] 'browserify' errored after 15 ms [01:21:03] ReferenceError: source is not defined at Gulp. (F:\CSC Assignments\FinalProject\HotelProject\gulpfile.js:109:15) at module.exports (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\lib\runTask.js:34:7) at Gulp.Orchestrator._runTask (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:273:3) at Gulp.Orchestrator._runStep (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:214:10) at Gulp.Orchestrator.start (F:\CSC Assignments\FinalProject\HotelProject\node_modules\gulp\node_modules\orchestrator\index.js:134:8) at C:\Users\LUCKYLAM\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129:20 at process._tickCallback (node.js:355:11) at Function.Module.runMain (module.js:503:11) at startup (node.js:129:16) at node.js:814:3
我是新手,在花了几个小时找出导致问题的原因后,我不知道这里出了什么问题。请帮忙。
这是我的 /app/js/script.js
require('angular');
var app = angular.module('app', []);
gulpfile.js:
gulp.task('browserify', function() {
return browserify('./app/js/script.js')
.bundle()
.pipe(source('main.js'))
// saves it the public/js/ directory
.pipe(gulp.dest('./dist/js/kk/'));
});
我的文件夹结构
我猜你错过了一个 npm package: vinyl-source-stream
.
尝试使用 npm install vinyl-source-stream --save-dev
安装它并在你的 gulpfile.js 中像这样要求:
var source = require('vinyl-source-stream');