sockets - 致命错误:这里套接字已经关闭 ('grunt contrib imagemin')

  显示原文与译文双语对照的内容
0 0

这是一个 gruntfile.json


 'use strict';
 module.exports = function(grunt) {


grunt.initConfig({
 pkg: grunt.file.readJSON('package.json'),
 imagemin: {
 options: {
 optimizationLevel: 3,
 flatten: true, 
 cache: false
 },
 build: {
 expand: true,
 cwd: 'public/images',
 src: ['**/*.{png,jpg,gif}'], 
 dest: 'images/min'
 }
 }

});
 grunt.loadNpmTasks('grunt-contrib-imagemin');
 grunt.registerTask('default', ['imagemin']);
 };

我得到了这个错误

致命错误:这里套接字已经关闭。

这是一个完整的错误细节


Command-line options: --verbose
 Reading"Gruntfile.js" Gruntfile...OK
 Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK
 Registering"grunt-contrib-imagemin" local Npm module tasks.
Reading C:UsersMohamedDesktopegwebstormnode_modulesgrunt-contrib-imageminpackage.json...OK
Parsing C:UsersMohamedDesktopegwebstormnode_modulesgrunt-contrib-imageminpackage.json...OK
Loading"imagemin.js" tasks...OK
+ imagemin
Loading"Gruntfile.js" tasks...OK
+ default
 No tasks specified, running default tasks.
Running tasks: default
 Running"default" task
 Running"imagemin" task
 Running"imagemin:build" (imagemin) task
Verifying property imagemin.build exists in config...OK
Files: public/images/facebook.png -> images/min/facebook.png
 ---- the list of other images -----
Options: interlaced, optimizationLevel=3, progressive, flatten, cache=false
Fatal error: This socket is closed.

并且没有创建或者改变任何图片文件夹,我查看了代码,但是我不知道是否有什么需要修改。

时间: 原作者:

0 0

尝试安装 imagemin:


npm uninstall grunt-contrib-imagemin
npm install --save-dev grunt-contrib-imagemin

原作者:
...