4

I'm getting this odd error as the title. The full message looks like this

$ 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

I'm new to this and after having spent a couple of hours figuring out what's causing the problem I have no idea what is wrong around here. Please help.

Here is my /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/'));
});

My folder structureenter image description here

0

1 Answer 1

13

I guess you are missing one npm package: vinyl-source-stream.

Try to install it with npm install vinyl-source-stream --save-dev and require in your gulpfile.js like so:

var source = require('vinyl-source-stream');
Sign up to request clarification or add additional context in comments.

1 Comment

You saved me. Thank you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.