【问题标题】:Error: Please install PostCSS 8 or above. how can I fix this?错误:请安装 PostCSS 8 或更高版本。我怎样才能解决这个问题?
【发布时间】:2021-08-25 18:56:50
【问题描述】:

这是我的 package.json 文件。我该如何解决这个问题?我尝试将 autoprefixer 的版本更改为 9.8.6,但没有成功。请帮我解决这个问题

{
  "name": "react-tailwindcss",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
  "@testing-library/jest-dom": "^5.13.0",
  "@testing-library/react": "^11.2.7",
  "@testing-library/user-event": "^12.8.3",
  "react": "^17.0.2",
  "react-dom": "^17.0.2",
  "react-scripts": "4.0.3",
  "web-vitals": "^1.1.2"
},
 "scripts": {
 "start": "npm run watch:css && react-scripts start",
 "build": "npm run build:css && react-scripts build",
 "test": "react-scripts test",
 "eject": "react-scripts eject",
 "build:css": "postcss src/assets/tailwind.css -o src/assets/main.css",
 "watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
},
 "eslintConfig": {
 "extends": [
  "react-app",
  "react-app/jest"
 ]
},
 "browserslist": {
 "production": [
  ">0.2%",
  "not dead",
  "not op_mini all"
],
 "development": [
  "last 1 chrome version",
  "last 1 firefox version",
  "last 1 safari version"
 ]
},
 "devDependencies": {
 "autoprefixer": "^9.8.6",
 "postcss-cli": "^8.3.1",
 "tailwindcss": "^2.1.4"
 }
}

这是我安装的依赖文件。它告诉我 Pleaseenter image description here install PostCSS 8 or above

【问题讨论】:

  • npm install postcss@latest --save-dev

标签: reactjs tailwind-css postcss autoprefixer postcss-cli


【解决方案1】:

看起来您已安装 postcss-cli,但 TailwindCSS 需要 postcss。你只需要安装它。这是所有主要包管理器的终端命令。

npm

npm i -D postcss@latest

纱线

yarn add -D postcss@latest

pnpm

pnpm i -D postcss@latest

【讨论】:

    猜你喜欢
    • 2012-03-16
    • 2013-10-24
    • 1970-01-01
    • 2020-02-21
    • 1970-01-01
    • 2019-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多