Skip to content

Commit

Permalink
Print a useful error if package.json is missing (#61)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
nunospot and sindresorhus committed Jul 31, 2019
1 parent 919a1d6 commit 6234bc9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Expand Up @@ -11,6 +11,11 @@ module.exports = (grunt, options = {}) => {

let cwd = process.cwd();
let config = options.config || pkgUp.sync();

if (config === null) {
grunt.fail.fatal('package.json not found. Make sure to create a package.json and install dependencies before you run Grunt.');
}

if (typeof config === 'string') {
const configPath = path.resolve(config);
cwd = path.dirname(configPath);
Expand Down

0 comments on commit 6234bc9

Please sign in to comment.