警告grunt-cssc@0.2.6需要grunt@~0.4.1的对等方,但没有安装

时间:2016-09-04 12:58:10

标签: node.js gruntjs

这里需要什么? 我试图安装所有引用:

>npm install
  

hertz@1.0.0 C:...... \ BowerAndGrunt` - UNMET PEER DEPENDENCY grunt@1.0.1

     

npm WARN grunt-cssc@0.2.6需要grunt@~0.4.1的同行,但没有人   安装。 npm WARN hertz@1.0.0没有存储库字段。错误的ERR!代码1

的package.json:

{
  "name": "hertz",
  "version": "1.0.0",
  "description": "desc",
  "main": "",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "legends",
  "license": "MIT",
  "dependencies": {
    "grunt": "^1.0.1"
  },
  "devDependencies": {
    "grunt": "^1.0.1",
    "grunt-contrib-concat": "1.0.1",
    "grunt-contrib-csslint": "1.0.0",
    "grunt-contrib-cssmin": "1.0.2",
    "grunt-contrib-jshint": "1.0.0",
    "grunt-contrib-sass": "1.0.0",
    "grunt-contrib-uglify": "2.0.0",
    "grunt-contrib-watch": "1.0.0",
    "grunt-htmlhint": "0.9.13",
    "jshint-stylish": "^2.2.1",
    "matchdep": "1.0.1"
  }
}

1 个答案:

答案 0 :(得分:3)

DO

npm install --save-dev grunt

这是因为grunt-cssc需要安装grunt,但你没有在你的pacakge json中定义它。 阅读有关对等依赖项的更多信息

https://nodejs.org/en/blog/npm/peer-dependencies/

编辑:

因为它要求的是像你一样小于版本1的咕噜声。在以下链接的npm中结帐semver:

github.com/npm/node-semver#tilde-ranges-123-12-1

基本上这意味着你的cssc lib需要grunt 0.4而不是grunt 1,但希望它也适用于grunt 1。

您可以联系lib作者并要求他升级以支持grunt 1.