grunt error: cannot find module 'globule'

grunt error: cannot find module 'globule'

当我 运行 g运行t 时,我收到以下错误消息:

Aborted due to warnings.
Marios-MacBook-Air:imageResizer mario$ grunt
Loading "watch.js" tasks...ERROR
>> Error: Cannot find module 'globule'
Warning: Task "watch" not found. Use --force to continue.

奇怪的是,以前 运行ning g运行t 可以正常工作,但没有对文件进行任何更改,现在 returns 出现此错误。

有谁知道可能导致此错误的原因以及模块 globule 是什么?

这是package.json

{
  "name": "imageResizer",
  "version": "1.0.0",
  "description": "Resize images using GraphicsMagick",
  "main": "index.js",
  "scripts": {
    "test": "mocha -R html-cov > coverage.html"
  },
  "author": "Mario Mendes",
  "license": "ISC",
  "dependencies": {
    "aws-sdk": "^2.1.14",
    "gm": "^1.17.0",
    "imagemagick": "^0.1.3",
    "underscore": "^1.8.3"
  },
  "devDependencies": {
    "blanket": "^1.1.6",
    "chai": "^2.1.0",
    "grunt": "^0.4.5",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-execute": "^0.2.2",
    "lodash": "^3.6.0",
    "mocha": "^2.1.0",
    "proxyquire": "^1.3.2"
  }
}

这是我的 g运行t 文件

var GruntHandler = require("./index.js").GruntHandler;

module.exports = function (grunt) {

    grunt.initConfig({

        pkg: grunt.file.readJSON('package.json'),

        module_target: {
            options: {

                module: true
            },
            files: ['index.js',]
        },

        watch: {
            scripts: {
                files: ['!images/dontdeleteme.png', 'images/*.*']
            }
        }
    });


    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-execute');

    var _800px = {
        width: 800,
        destinationPath: "large"
    };

    var _500px = {
        width: 500,
        destinationPath: "medium"
    };

    var _200px = {
        width: 200,
        destinationPath: "small"
    };

    var _45px = {
        width: 45,
        destinationPath: "thumbnail"
    };

    var _sizesArray = [_800px, _500px, _200px, _45px];

    grunt.event.on('watch', function(action, filepath, target) {
        if (action === "delete") {
            console.log("Deleted image");
        }
        GruntHandler(filepath, _sizesArray);
    });



    grunt.registerTask('default', ['watch']);



    grunt.task.exists('watch');
}

您的一些 grunt-tasks 似乎使用了 globule 模块(请参阅 https://www.npmjs.com/package/globule) but it has not specified it in its dependencies. Actually the grunt API 提供抽象此库的方法,所以我猜有些库已弃用或过时....

也许您 运行 是您的 grunt 依赖项之一的旧版本,请尝试在 grunt.

之前执行 npm install

最后但同样重要的是:如果这不起作用,请检查您的 npm 缓存。 运行 npm cache cleannpm prune 清理您的项目。

祝你好运。