【问题标题】:Issue while installing grunt-critical-css安装 grunt-critical-css 时出现问题
【发布时间】:2016-07-30 18:53:20
【问题描述】:

我正在尝试安装

sudo npm install grunt-critical-css --save-dev

Password:**********

我一直得到

npm WARN deprecated npmconf@2.0.9: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN grunt-penthouse@0.3.0 requires a peer of grunt@~0.4.2 but none was installed.

我试过了

sudo npm update -g npm

/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/lib
└── npm@3.8.7 

sudo npm install -g grunt-cli

/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
/usr/local/lib
└── grunt-cli@1.2.0

sudo npm install grunt-critical-css --save-dev

npm WARN deprecated npmconf@2.0.9: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN grunt-penthouse@0.3.0 requires a peer of grunt@~0.4.2 but none was installed.

我在这里做错了什么?有人可以填写我遗漏的吗?


详情

npm v3.8.7 
grunt-cli v1.2.0
grunt v1.0.1

Gruntfile.js

criticalcss: {
    custom: {
        options: {
            url: "http://localhost:8888",
            width: 1200,
            height: 900,
            outputfile: "public/dist/wedding/css/critical.css",
            filename: "public/dist/wedding/css/all.css",
            buffer: 800*1024,
            ignoreConsole: false
        }
    }
},

加载它

grunt.loadNpmTasks('grunt-critical-css');

叫它

 grunt.registerTask('default', [

    'clean:dist',
    'concat',
    'uglify',
    'cssmin',
    // 'htmlmin',
    'compress',
    'criticalcss'

]);

结果

咕哝

Warning: Task "criticalcss" not found. Use --force to continue.
Aborted due to warnings.

咕噜 --force

Warning: Task "criticalcss" not found. Used --force, continuing.
Done, but with warnings.

去检查文件

Nothing generated 

【问题讨论】:

  • 嗨@cyber8200 你找到解决方案了吗?我面临同样的问题。但是,我没有找到任何解决方案。你能帮帮我吗?

标签: node.js gruntjs


【解决方案1】:

这些是警告消息,通常即使您有这些消息,您的npm install 也会成功进行。

这些消息是根据您安装的软件包的所有package.json 依赖注册表以及您正在安装的软件包的所有层次依赖关系生成的。

例如,您正在安装的软件包grunt-critical-css 具有此package.json https://github.com/filamentgroup/grunt-criticalcss/blob/master/package.json 例如具有此依赖关系grunt-cli 具有此package.json https://github.com/gruntjs/grunt-cli/blob/master/package.json ...等等。

在您的情况下,其中一个依赖包,即 npmconf@2.0.9 已被贬值。

【讨论】:

  • 你建议我如何修复npmconf@2.0.9 has been depreciated 错误?请多多指教。
  • 除了发出警告之外,是否会导致问题
  • 当我运行grunt 时,我得到了这个grunt Warning: Task "criticalcss" not found. Use --force to continue. Aborted due to warnings.
【解决方案2】:

这个插件需要 Grunt ~0.4.2

看起来您没有安装正确的 Grunt 版本。 试试这个:

npm update -g npm

或

sudo npm update -g npm

然后:

npm install -g grunt-cli

【讨论】:

  • 好的,让我试试。谢谢。
  • 我尝试更新 npm 和 grunt,并尝试再次安装,sudo npm install grunt-critical-css --save-dev 仍然出现相同的错误。 npm WARN deprecated npmconf@2.0.9: this package has been reintegrated into npm and is now out of date with respect to npm npm WARN grunt-penthouse@0.3.0 requires a peer of grunt@~0.4.2 but none was installed.
  • @ihue 您当前的 nodeJS、npm、grunt 版本是什么?看起来一切都安装成功了......它只是警告消息
  • 我已经添加了详细信息。对不起。
  • @ihue 现在尝试使用grunt-critical-css,即使您有此警告
猜你喜欢
  • 2013-07-14
  • 1970-01-01
  • 2021-04-05
  • 1970-01-01
  • 2017-02-24
  • 1970-01-01
  • 1970-01-01
  • 2017-01-26
  • 2012-03-22
相关资源
最近更新 更多