警告:[object Object] 不是 PostCSS 插件。带有自动前缀的 GruntJS

Warning: [object Object] is not a PostCSS plugin. GruntJS with autoprefixer

我正在尝试将 PostCSS 插件 autoprefixer 与 grunt 一起使用。我浏览了许多相关的文章和 Whosebug 答案,但我仍然收到“警告:[object Object] 不是 PostCSS 插件使用 --force 继续”。

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        sass: {
            dist: {
                files: {
                    'css/style.css' : 'scss/style.scss'
                }
            }
        },
        watch: {
            css: {
                files: '**/*.scss',
                tasks: ['sass']
            }
        },
        postcss: {
            options: {
                map: true,
                processors: [
                    require('autoprefixer')()
                ]
            },
            dist: {
                src: 'css/*.css'
            }
        }
    });
    grunt.loadNpmTasks('grunt-contrib-sass');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-postcss');
    grunt.registerTask('dev',['sass','watch']);
    grunt.registerTask('build',['sass', 'postcss']);
}

package.json
  "devDependencies": {
    "grunt": "^1.4.0",
    "grunt-contrib-sass": "^2.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-postcss": "^0.9.0",
    "postcss": "^8.3.0",
    "autoprefixer": "^10.2.6"
  }


I am a newbie so please help.

尚不确定根本原因是什么,但将 autoprefixer 降级到版本 9 可以解决问题

package.json
  "devDependencies": {
    "grunt": "^1.4.0",
    "grunt-contrib-sass": "^2.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-postcss": "^0.9.0",
    "postcss": "^8.3.0",
    "autoprefixer": "^9.8.6"
  }