警告 grunt-cssc@0.2.6 需要 grunt@~0.4.1 的对等体,但已安装 none

WARN grunt-cssc@0.2.6 requires a peer of grunt@~0.4.1 but none was installed

这里需要什么? 我尝试安装所有参考资料:

>npm install

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

npm WARN grunt-cssc@0.2.6 requires a peer of grunt@~0.4.1 but none was installed. npm WARN hertz@1.0.0 No repository field. npm ERR! code 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"
  }
}

npm install --save-dev grunt

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

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

编辑:

因为它要求的咕噜声比您拥有的版本 1 还低。在以下 link 中检查 npm 中的 semver:

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

基本上这意味着您的 cssc 库需要 grunt 0.4 而不是 grunt 1,但希望它也能与 grunt 1 一起使用。

你可以联系lib作者让他也升级支持grunt 1