Recently, when I compile my scss files I get an error. The error message says:
Browserslist: caniuse-lite is outdated. Please run next command
n
I found a short cut rather than going through vs code appData/webCompiler
, I added it as a dependency to my project with this cmd npm 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 do npm i
.
Update:
In case, Above solution didn't fix it. You could run npm update
, as this would upgrade deprecated/outdated packages.
Note:
After you've run the npm update, there may be missing dependencies. Trace the error and install the missing dependencies. Mine was nodemon, which I fix by npm i nodemon -g
Although, I'm answering this very late. I have a bad habit of checking changelogs of every library I use
npm --depth 9999 update
fixed the issue for me--apparently because package-lock.json
was insisting on the outdated versions.
I'm not exactly sure where my problem was, but I believe it was because I was using the same 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:
npm ls -g --depth=0
for Yarn:
yarn global list
I then uninstalled each package I saw in the npm listing, using:
npm uninstall -g <package-name>
Deleting node_modules
and package-lock.json
and npm i
solve the issue for me.
I am writing as a full answer because it is easy to miss his comment.
npm --depth 20 update caniuse-lite browserslist
This is good because:
There is no deletion of package-lock.json
. Deleting that leaves you vulnerable to many packages getting upgraded with breaking changes.
It is explicit and very limited on which things are to be updated.
It avoids the very large depth of 99 or 9999 which will work on some projects and systems, but not on others. If you have limited the depth to too small a number, it will not break anything. You can increase the depth and try again, until the project compiles successfully.