E
E
Emptyform2016-10-11 12:19:51
JavaScript
Emptyform, 2016-10-11 12:19:51

Why is the grunt task not running?

Hey!
Content of Gruntfile.js :

module.exports = function(grunt) {
  require("load-grunt-tasks")(grunt);

  console.log('=====> 1');
  grunt.loadNpmTasks('grunt-lintspaces');
  console.log('=====> 2');

  var config = {
    pkg: grunt.file.readJSON("package.json"),

    lintspaces: {
      codestyle: {
        src: [
          "**/*.js"
        ],
        options: {
          editorconfig: ".editorconfig"
        }
      }
    }
  };

  grunt.registerTask("linter", ["lintspaces:codestyle"]);

  grunt.initConfig(config);
};

I run the grunt linter command I get the following error:
>grunt linter
=====> 1
>> Local Npm module "grunt-lintspaces" not found. Is it installed?
=====> 2
Warning: Task "lintspaces:codestyle" not found. Use --force to continue.
Aborted due to warnings.

The /node_modules/ folder is not located inside the project folder, but one level higher. I take it this is the problem? I don't want /node_modules/ to be in the project folder. Can this be bypassed somehow?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nicholas, 2016-10-11
@Emptyform

What is the problem with the node_modules folder in the project? This is the common practice.
From the loadNpmTask documentation:

Load tasks from the specified Grunt plugin. This plugin must be installed locally via npm, and must be relative to the Gruntfile.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question