Recently, when I compile my scss files I get an error. The error message says:
Browserslist: caniuse-lite is outdated. Please run next command
npm update caniuse-lite 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.
If I remove
"options": {
"autoPrefix": "> 1%"
}
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.
To fix the issue you can type below command:
In my case this works fine...
sudo npm i -g browserslist caniuse-lite
I did downgrade the node version from 12 to 10
EDIT
This error occurred with me because I was using node version 12. When I downgrade to version 10.16.5 this error stops. This error happened in my local env, but in prod and staging, it not happens. In prod and staging node version is 10.x so I just do this and I didn't need to update any package in my package.json
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:
C:\Users\USERNAME\AppData\Local\Temp\WebCompilerX.X.X
(X is the version of WebCompiler)node_modules
folder:caniuse-lite
andbrowserslist
Open up CMD (insideC:\Users\USERNAME\AppData\Local\Temp\WebCompilerX.X.X
) and run:npm i caniuse-lite browserslist
I found a short cut rather than going through
vs code appData/webCompiler
, I added it as a dependency to my project with this cmdnpm i caniuse-lite browserslist
. But you might install it globally to avoid adding it to each project.After installation, you could remove it from your project
package.json
and donpm i
.In my case, I deleted out the
caniuse-lite
,browserslist
folders fromnode_modules
.Then I type the following command to install the packages.
worked fine.