简体   繁体   中英

why grunt is failing at imagemin dependency?

I am using node version 0.12.2 and npm version 3.3.6. I am using yeoman tool to create angular app. When i run grunt it is aborting at imagemin dependency. I tried command npm install -g grunt-contrib-imagemin and npm install imagemin too.Still i am facing the same error:

Execution Time (2015-12-27 19:17:59 UTC)
    loading tasks          87ms  ▇▇ 3%
    loading grunt-svgmin     2s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 75%
    svgmin:dist           566ms  ▇▇▇▇▇▇▇▇▇ 21%
    Total 2.6s
        Warning: Running "imagemin:dist" (imagemin) task
    Fatal error: Cannot read property 'contents' of undefined
     Aborted due to warnings.

Here is my package.json:

{
  "name": "cordapp",
  "private": true,
  "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-angular-templates": "^0.5.7",
    "grunt-autoprefixer": "^2.0.0",
    "grunt-concurrent": "^1.0.0",
    "grunt-contrib-clean": "^0.6.0",
    "grunt-contrib-concat": "^0.5.0",
    "grunt-contrib-connect": "^0.9.0",
    "grunt-contrib-copy": "^0.7.0",
    "grunt-contrib-cssmin": "^0.12.0",
    "grunt-contrib-htmlmin": "^0.4.0",
    "grunt-contrib-imagemin": "^0.9.2",
    "grunt-contrib-jshint": "^0.11.0",
    "grunt-contrib-uglify": "^0.7.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-filerev": "^2.1.2",
    "grunt-google-cdn": "^0.4.3",
    "grunt-karma": "*",
    "grunt-newer": "^1.1.0",
    "grunt-ng-annotate": "^0.9.2",
    "grunt-svgmin": "^2.0.0",
    "grunt-usemin": "^3.0.0",
    "grunt-wiredep": "^2.0.0",
    "jit-grunt": "^0.9.1",
    "jshint-stylish": "^1.0.0",
    "karma-jasmine": "*",
    "karma-phantomjs-launcher": "*",
    "time-grunt": "^1.0.0"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "scripts": {
    "test": "grunt test"
  }
}

Any help would be appreciated.

Clean your npm cash and reinstall grunt-contrib-imagemin

npm cache clean && npm install grunt-contrib-imagemin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM