Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`

9.6k views Asked by At

I have 2 Next.js applications running with the same message error: Browserslist: caniuse-lite is outdated. Please run next command 'yarn upgrade'. The message shows up when I run commands like yarn dev or yarn start or yarn build. It's happening the same with NPM.

  • I've tried the command (yarn upgrade) many times with no success;
  • I've tried already to delete the lock files and also the node_modules but the message still;
  • I've tried with both Visual Studio and Terminal (Ubuntu);

It was fine a couple of days ago so I'm not sure if it's related to some new package update.

Anyone else having the same?

My package.json is:

{
  "name": "website-2020",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "node server.js",
    "build": "next build",
    "start": "NODE_ENV=production node server.js",
  },
  "dependencies": {
    "@tanem/react-nprogress": "^3.0.24",
    "@zeit/next-sass": "^1.0.1",
    "express": "^4.17.1",
    "isomorphic-unfetch": "^3.0.0",
    "next": "^9.3.5",
    "node-sass": "^4.14.0",
    "prop-types": "^15.7.2",
    "react": "^16.13.1",
    "react-bootstrap": "^1.0.1",
    "react-data-table-component": "^6.8.0",
    "react-dom": "^16.13.1",
    "react-icons": "^3.10.0",
    "reactstrap": "^8.4.1",
    "styled-components": "^5.1.0"
  },
  "devDependencies": {
    "faker": "^4.1.0"
  }
}
1

There are 1 answers

0
Nick On

The message might not be impacting your project. In which case you could ignore it. But if it is an issue

yarn upgrade will obey the limits set in the package.json. Carets in front of ^version will update you to all future minor/patch versions, without incrementing the major version. e.g. ^2.3.4 will use releases from 2.3.4 to <3.0.0.

Try run npx browserslist@latest --update-db

This may error, but should at least tell you the latest version of caniuse-lite.

If it errored, then try yarn why caniuse-lite

This will tell you which dependencies are using caniuse-lite and which version they are using. You may need to run yarn why <dependencyNameHere> to trace those child dependencies back to a package listed in your package.json.

Then you can install the latest of each. Hopefully this will fix your issue.