diff --git a/index.js b/index.js index bc1a1c31..686583df 100644 --- a/index.js +++ b/index.js @@ -147,11 +147,23 @@ function handleArguments(env) { } if (!env.modulePath) { + var missingNodeModules = + fs.existsSync(path.join(env.cwd, 'package.json')) + && !fs.existsSync(path.join(env.cwd, 'node_modules')); + + var missingGulpMessage = + missingNodeModules + ? 'Local modules not found in' + : 'Local gulp not found in'; log.error( - ansi.red('Local gulp not found in'), + ansi.red(missingGulpMessage), ansi.magenta(tildify(env.cwd)) ); - log.error(ansi.red('Try running: npm install gulp')); + var installCommand = + missingNodeModules + ? 'npm install' + : 'npm install gulp'; + log.error(ansi.red('Try running: ' + installCommand)); exit(1); }