1

我使用的是节点版本 0.12.2 和 npm 版本 3.3.6。我正在使用 yeoman 工具来创建 Angular 应用程序。当我运行 grunt 时,它在 imagemin 依赖项中中止。npm install -g grunt-contrib-imagemin我也 尝试了命令。我npm install imagemin仍然面临同样的错误:

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.

这是我的 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"
  }
}

任何帮助,将不胜感激。

4

1 回答 1

1

清理你的 npm cash 并重新安装 grunt-contrib-imagemin

npm 缓存清理 && npm install grunt-contrib-imagemin

于 2015-12-28T10:07:30.130 回答