Error: PostCSS plugin autoprefixer requires PostCSS 8. Update PostCSS or downgrade this plugin

前端 未结 10 551
谎友^
谎友^ 2021-02-03 21:24

I am getting this error whenever I run npm start. I tried a couple of fixes but none of them work for me. I tried to change the version of autoprefixer to 9.8.6 but it didn\'t w

相关标签:
10条回答
  • 2021-02-03 21:39

    Quick fix

    Downgrade your autoprefixer to version 9, use

    "autoprefixer": "^9.0.0"

    in your dev dependencies.

    More details

    PostCSS was updated to version 8, however, PostCSS CLI has not yet been updated to handle PostCSS plugins which use the new PostCSS 8+ API. Autoprefixer uses the new PostCSS 8 API since version 10.

    This is documented under known issues in the PostCSS GitHub page.

    Once PostCSS CLI is updated to handle plugins that use the new PostCSS 8+ API, this will likely not be an issue. But until then, you may need to downgrade some PostCSS plugins to avoid errors.

    0 讨论(0)
  • 2021-02-03 21:41
    "dependencies": {
        "autoprefixer": "^9.8.6",
        "postcss": "^8.0.0",
        "postcss-cli": "^8.1.0",
        "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.0.2",
    },
    

    Dependecies object and version can be modified directly in the package.json file and it work

    0 讨论(0)
  • 2021-02-03 21:43

    These steps worked for me. This was from github

    npm uninstall tailwindcss postcss autoprefixer
    npm install tailwindcss@latest postcss@latest autoprefixer@latest
    
    npx tailwindcss init -p
    
    npm uninstall tailwindcss postcss autoprefixer
    npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
    
    0 讨论(0)
  • 2021-02-03 21:44

    For Next.js 10 you just have to do

    npm install tailwindcss@latest postcss@latest autoprefixer@latest
    

    Source This issue here

    0 讨论(0)
  • 2021-02-03 21:46

    the following combo works as of Oct 2020

      ...
      "dependencies": {
        "autoprefixer": "^9.8.6",
        "postcss-cli": "^8.1.0",
        "tailwindcss": "^1.9.2"
      }
    
    0 讨论(0)
  • 2021-02-03 21:47

    I am not sure about this but can you try installing postcss as a dependency?

    npm i postcss
    
    0 讨论(0)
提交回复
热议问题