最近,当我编译我的scss文件时,我得到一个错误。错误信息如下:
Browserslist: canius -lite已经过时。请运行下一个命令npm update canius -lite browserslist
首先,正如消息所说,我运行npm update canius -lite browserslist,但它没有解决这个问题。
我删除了整个node_modules目录并重新安装,我也通过npm update更新了整个文件夹,但没有一个解决了这个问题。
我还重新安装了autoprefixer和browserslist,但没有一个解决问题。
如果我移除
"options": {
"autoPrefix": "> 1%"
}
从我的编译配置。Json,一切都很好,这意味着它可能与autoprefixer有关。另外,我手动将包版本更改为包上的最新版本。Json和重新安装,但没有运气。
我的问题通过在我的react native项目中这样做来解决
NPX browserslist@latest——update-db
控制台- - - >
Latest version: 1.0.30001363
Installed version: 1.0.30001296
Removing old caniuse-lite from lock file
Installing new caniuse-lite version
$ npm install caniuse-lite
npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uglify-es@3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
Cleaning package.json dependencies from caniuse-lite
$ npm uninstall caniuse-lite
caniuse-lite has been successfully updated
Target browser changes:
- and_chr 96
+ and_chr 103
- and_ff 95
+ and_ff 101
- android 96
+ android 103
- chrome 96
- chrome 95
- chrome 94
+ chrome 103
+ chrome 102
+ chrome 101
- edge 96
- edge 95
+ edge 103
+ edge 102
- firefox 95
- firefox 94
+ firefox 102
+ firefox 101
- ios_saf 15.2
- ios_saf 15.0-15.1
+ ios_saf 15.5
+ ios_saf 15.4
+ ios_saf 15.2-15.3
- opera 82
- opera 81
+ opera 87
+ opera 86
+ opera 85
- safari 15.2
- safari 15.1
- safari 13.1
+ safari 15.5
+ safari 15.4
- samsung 15.0
- samsung 14.0
+ samsung 17.0
+ samsung 16.0
我也有同样的问题,这个命令对我有用
NPM I autoprefixer@latest
它自动在包中添加需要的依赖项。Json和包锁。Json文件如下:
package.json
"autoprefixer": "^9.6.5",
package-lock.json
"@angular-devkit/build-angular": {
...
"dependencies": {
"autoprefixer": {
"version": "9.4.6",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.4.6.tgz",
"integrity": "sha512-Yp51mevbOEdxDUy5WjiKtpQaecqYq9OqZSL04rSoCiry7Tc5I9FEyo3bfxiTJc1DfHeKwSFCUYbBAiOQ2VGfiw==",
"dev": true,
"requires": {
"browserslist": "^4.4.1",
"caniuse-lite": "^1.0.30000929",
"normalize-range": "^0.1.2",
"num2fraction": "^1.2.2",
"postcss": "^7.0.13",
"postcss-value-parser": "^3.3.1"
}
},
...
}
...
"autoprefixer": {
"version": "9.6.5",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-9.6.5.tgz",
"integrity": "sha512-rGd50YV8LgwFQ2WQp4XzOTG69u1qQsXn0amww7tjqV5jJuNazgFKYEVItEBngyyvVITKOg20zr2V+9VsrXJQ2g==",
"requires": {
"browserslist": "^4.7.0",
"caniuse-lite": "^1.0.30000999",
"chalk": "^2.4.2",
"normalize-range": "^0.1.2",
"num2fraction": "^1.2.2",
"postcss": "^7.0.18",
"postcss-value-parser": "^4.0.2"
},
...
}