Warning from npm - caniuse-lite is outdated

I’m getting the following warning when I run mix phx.server:

Browserslist: caniuse-lite is outdated.
  Please run next command
  `npm update caniuse-lite browserslist`

I tried running the command, and got no errors, but the warning didn’t go away. I also tried mix clean; mix compile, to no avail. Suggestions?

Did you run the command in the assets directory, where the npm assets live?

1 Like

That warning is shown because of the defined version of “caniuse-lite” in assets/package-lock.json file.

I sended a pull-request for update the version. :slight_smile:

I have this complaining when I run the phoenix server.

iex(1)> Browserslist: caniuse-lite is outdated. Please run:
  npx browserslist@latest --update-db
  Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating

so I go to the assets folder and run:
npx browserslist@latest --update-db

then it complains for this:

Need to install the following packages:
Ok to proceed? (y) y

  throw new BrowserslistUpdateError(
Error [BrowserslistUpdateError]: No lockfile found. Run "npm install", "yarn install" or "pnpm install"
    at detectLockfile (/Users/romenigld/.npm/_npx/072487b38308305a/node_modules/update-browserslist-db/index.js:54:9)
    at updateDB (/Users/romenigld/.npm/_npx/072487b38308305a/node_modules/update-browserslist-db/index.js:258:14)
    at Object.<anonymous> (/Users/romenigld/.npm/_npx/072487b38308305a/node_modules/browserslist/cli.js:42:3)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  browserslist: true

Node.js v18.2.0
npm notice
npm notice New minor version of npm available! 8.9.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice

I want to know if it’s ok to update the npm with the phoenix v1.6.10?

I’d just leave the caniuse-lite warning alone. Doesn’t hurt anything. I am not brave enough to dig in the rabbit hole of npm.


Upgrading the Tailwind CLI version helps with this – it’s Tailwind CSS which ships with these node modules, and they tend to get outdated over time.

  1. Adjust the Tailwind config by editing config/config.exs
  2. Run mix tailwind.install to pick up the new configuration, upgrading Tailwind CLI