node.js - 警告 grunt-cssc@0.2.6 需要 grunt@~0.4.1 的同级,但没有安装

标签 node.js gruntjs

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

>npm install

[email protected] C:...\BowerAndGrunt `-- UNMET PEER DEPENDENCY [email protected]

npm WARN [email protected] requires a peer of grunt@~0.4.1 but none was installed. npm WARN [email protected] No repository field. npm ERR! code 1

包.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,但你没有在 pacakge json 中定义它。 了解有关对等依赖关系的更多信息

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

编辑:

因为它要求的 grunt 小于您所拥有的版本 1。在以下链接中检查 npm 中的 semver:

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

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

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

关于node.js - 警告 grunt-cssc@0.2.6 需要 grunt@~0.4.1 的同级,但没有安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39317145/

相关文章:

node.js - Bootstrap LESS - Grunt 监视输出到特定目录

css - 如何扩展 sass/compass 库

node.js - 推荐将配置传递给模块的方法

node.js - 无法访问 NPM 环境变量

node.js - NPM 脚本包含括号语法错误

node.js - 通过 Mongoose 中的对象字段值数组更新多个文档

javascript - Go 中的 Date.now() 等价物

gruntjs - Grunt 插件 grunt-exec v2.0.0 不执行简单命令,而 v1.0.1 则执行

javascript - grunt-contrib-watch 静默退出

javascript - sails.js 中的 Grunt 无法识别新任务