问题描述
最近,当我编译 scss 文件时出现错误.错误消息说:
Recently, when I compile my scss files I get an error. The error message says:
浏览器列表:caniuse-lite 已过时.请运行下一个命令 npm update caniuse-lite browserslist
首先,正如消息所说,我运行了 npm update caniuse-lite browserslist
但它没有解决问题.我删除了整个 nod-modules 目录并再次安装,我也通过 npm update
更新了整个文件夹,但没有一个解决了问题.我还重新安装了 autoprefixer 和 browserslist,但都没有解决问题.
First, as the message says, I ran npm update caniuse-lite browserslist
but it didn't fix the issue.I deleted the whole nod-modules directory and installed again, also I updated the whole folder by npm update
but none of them solved the issue.I also reinstalled autoprefixer and browserslist but none of them solved the issue.
如果我删除
"options": {
"autoPrefix": "> 1%"
}
从我的 compilerconfig.json
来看,一切正常,这意味着它可能与 autoprefixer 有关.另外,我在 package.json
上手动将包版本更改为最新版本并重新安装,但没有成功.
from my compilerconfig.json
, everything works fine which means probably it is related to autoprefixer. Also, I manually changed the package version to the latest version on package.json
and reinstalled but no luck.
推荐答案
听起来您正在使用 Visual Studio 的 Web Compiler 扩展.这里有一个未解决的问题:https://github.com/madskristensen/WebCompiler/issues/413
It sounds like you are using Visual Studio's Web Compiler extension. There is an open issue for this found here: https://github.com/madskristensen/WebCompiler/issues/413
在该问题中发布了一个解决方法:
There is a workaround posted in that issue:
- 关闭 Visual Studio
- 前往
C:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X
(X 是 WebCompiler 的版本) - 从
node_modules
文件夹中删除以下文件夹:caniuse-lite
和browserslist
打开 CMD(在C:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X
内)并运行:npm i caniuse-lite browserslist
- Close Visual Studio
- Head to
C:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X
(X is the version of WebCompiler) - Delete following folders from
node_modules
folder:caniuse-lite
andbrowserslist
Open up CMD (insideC:UsersUSERNAMEAppDataLocalTempWebCompilerX.X.X
) and run:npm i caniuse-lite browserslist
这篇关于浏览器列表:caniuse-lite 已过时.请运行下一个命令`npm update caniuse-lite browserslist`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!