Emptyform
@Emptyform

Почему не выполняется grunt task?

Привет!

Содержимое 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);
};


Запускаю команду grunt linter, получаю ошибку:
>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.


Папка /node_modules/ у меня расположена не внутри папки проекта, а на уровень выше. Я так понимаю, проблема в этом? Я не хочу чтобы /node_modules/ лежала в папке проекта. Можно это обойти как-то?
  • Вопрос задан
  • 180 просмотров
Решения вопроса 1
А в чём проблема с папкой node_modules в проекте? Это же общепринятая практика.
Из документации к loadNpmTask:
Load tasks from the specified Grunt plugin. This plugin must be installed locally via npm, and must be relative to the Gruntfile.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы