I'm building an app using vuejs3 and tailwindcss
I was testing some configurations before starting the project then I got this error
npm run build
throws:
ERROR Failed to compile with 1 error 2:48:15 PM
error in ./src/styles/index.css
Error: PostCSS plugin postcss-purgecss requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
@ ./src/main.js 9:0-28
@ multi ./src/main.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test-vue-env@0.1.0 build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test-vue-env@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
And here is my devDependencies
in package.json
:
{
"devDependencies": {
"@fullhuman/postcss-purgecss": "^4.0.0",
"@fullhuman/vue-cli-plugin-purgecss": "~4.0.2",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/eslint-config-prettier": "^6.0.0",
"autoprefixer": "^10.2.5",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^7.0.0-0",
"node-sass": "^5.0.0",
"postcss": "^8.2.8",
"prettier": "^1.19.1",
"sass-loader": "^10.1.1",
"tailwindcss": "^2.0.3"
}
}
Thanks for your time !
According to the official docs you should do:
npm uninstall tailwindcss postcss autoprefixer
then
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
Note : to avoid any issue you could delete the package-lock.json
then run the commands above.