I was writing the latest project of vue3.0. Once I deleted the node_modules package and reinstalled it, the terminal appeared Error: PostCSS plugin autoprefixer requires PostCSS 8.
Solution: set autoprefixer to 9.0.0:
"autoprefixer": "9.0.0",
I was writing the latest project of vue3.0. Once I deleted the node_modules package and reinstalled it, the terminal appeared Error: PostCSS plugin autoprefixer requires PostCSS 8.
Solution: set autoprefixer to 9.0.0:
"autoprefixer": "9.0.0",
There was a problem installing postcss pxtorem
Solve the problem of installing the postcss pxtorem plug-in in Vue and reporting an error “error: postcss plugin postcss pxtorem requires postcss 8.”
solve:
Upgrade postcss version or downgrade postcss pxtorem version
npm i [email protected]
This error occurs when packaging with postcss: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.
I’ve been searching for information for a long time because the versions are incompatible,
Solution: create a new postcss.config.js file under the root directory
The file configuration is as follows
module.exports={
plugins:[
require("postcss-preset-env")
]
}
Then delete the options in webpack.config.js and package again.
Using vant to adapt REM to
any gate vant
If necessary rem
It is recommended to use the following two tools for adaptation
postcss-pxtorem Is a post CSS plug-in, used to convert PX units into REM units lib flexible Used to set the REM reference value
npm install postcss-pxtorem --save-dev
npm i -S amfe-flexible
Create a new postcss. Config. JS
in the root directory
module.exports = {
plugins: {
'autoprefixer': {
browsers: ['Android >= 4.0', 'iOS >= 8']
},
'postcss-pxtorem': {
rootValue: 37.5,
propList: ['*']
}
}
}
Introduce main.js again
import 'amfe-flexible'
NPM run serve startup found an error
Check that the package.json version is too high
“postcss pxtorem”: “^ 6.0.0”,
Degraded version
npm i [email protected]
e.g. run serve 21551; 36816;