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.
I'm not exactly sure where my problem was, but I believe it was because I was using global packages from both npm and Yarn.
I uninstalled all the npm global packages, then when using yarn commands once again, the problem was gone.
To see global packages installed...
for npm:
for Yarn:
I then uninstalled each package I saw in the npm listing, using:
I had same problem too this command works for me
npm i autoprefixer@latest
It automatically added need dependency in
package.json
andpackage-lock.json
file like below:package.json
package-lock.json
For Angular Developers
Although, I'm answering this very late but I have a bad habit of checking changelogs of every library I use
Continuation of answer above.
Had the same "plugin error" as @MehrdadBabaki. I uninstalled web compiler, deleted the AppData WebCompiler folder mentioned above, then reopened VS2019 and reinstalled web compiler.
THEN I went to the WebCompiler folder again and did
npm i autoprefixer@latest
npm i caniuse-lite@latest
andnpm i caniuse-lite browserslist@latest
As mentioned in Scott Kuhl's answer this issue is mentioned in https://github.com/madskristensen/WebCompiler/issues/413
For me, running the command
npm i caniuse-lite- browserslist
only worked for about 1/2 a day before it was an issue again.The following solution, mentioned in the post, works much better. This updates the node.js file so that it uses
console.log
instead ofconsole.warn
when returning these errors.You can manually update this file located at C:\Users\[Username]\AppData\Local\Temp\WebCompiler[VersionNumber]\node_modules\browserslist
Or, so that it is done automatically, add the following to your .csproj file by:
</Project>
end tag and before the build web compiler package was imported.npm --depth 9999 update
fixed the issue for me--apparently becausepackage-lock.json
was insisting on the outdated versions.