Skip to content

Commit 83bbab6

Browse files
committed
fix(gulp): handle gulpfile edge case
1 parent 9219fee commit 83bbab6

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/cli.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,14 @@ Cli.run = function run(processArgv) {
143143
logging.logger.debug('Gulpfile found');
144144
var beforeHook = argv._[0] + ':before';
145145
var afterHook = argv._[0] + ':after';
146-
var gulp = require(path.resolve(process.cwd() + '/node_modules/gulp'));
146+
try {
147+
var gulp = require(path.resolve(process.cwd() + '/node_modules/gulp'));
148+
} catch(e) {
149+
// Empty gulpfile (or one that doesn't require gulp?), and no gulp
150+
console.error('Gulpfile detected, but gulp is not installed');
151+
console.error('Do you need to npm install?\n');
152+
process.exit(1);
153+
}
147154
logEvents(gulp);
148155

149156
return Q.nfcall(gulp.start.bind(gulp), beforeHook).then(

0 commit comments

Comments
 (0)