romenigld

romenigld

Running Phoenix Server is warning from npm - caniuse-lite is outdated

When I run the Phoenix server It complains this warnings:

Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme

So I go to the assets folder and run these command:

 
 npx update-browserslist-db@latest
Need to install the following packages:
  update-browserslist-db@1.0.11
Ok to proceed? (y) y
update-browserslist-db: Cannot find package.json. Is this the right directory to run `npx update-browserslist-db` in?
npm notice
npm notice New minor version of npm available! 9.5.0 -> 9.6.5
npm notice Changelog: https://github.com/npm/cli/releases/tag/v9.6.5
npm notice Run npm install -g npm@9.6.5 to update!
npm notice
❯ asdf current
elixir          1.14.3-otp-25   /Users/romenigld/.tool-versions
erlang          25.2.3          /Users/romenigld/.tool-versions
nodejs          19.7.0          /Users/romenigld/.tool-versions
postgres        14.3            /Users/romenigld/.tool-versions
ruby            3.0.0           /Users/romenigld/.tool-versions
yarn            1.22.10         /Users/romenigld/.tool-versions
❯ npm -v
9.5.0
❯ npm install -g npm@9.6.5

removed 1 package, and changed 47 packages in 4s

18 packages are looking for funding
  run `npm fund` for details
Reshimming asdf nodejs...
❯ npm fund
assets

so I tried again to run the phoenix server and the same message was complaining:

 Browserslist: caniuse-lite is outdated. Please run:
 npx update-browserslist-db@latest
...

So after this, I run the following commands:

❯ mix clean
❯ mix compile

And tried to run the server again and the same message warning is complaining.

So it go again to the assets folder and installed the npm it compains to this:

❯ cd assets
❯ npm install
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /Users/romenigld/workspace/phoenix/phoenix_live_view/pragprog/phoenix-liveview-2nd-course/rld_code/rld_live_view_studio/assets/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/Users/romenigld/workspace/phoenix/phoenix_live_view/pragprog/phoenix-liveview-2nd-course/rld_code/rld_live_view_studio/assets/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/romenigld/.npm/_logs/2023-04-28T14_28_33_871Z-debug-0.log

Could anyone help me with this?
What I need to do now for fix this?

Marked As Solved

linusdm

linusdm

For what it’s worth, I’ve initiated a PR to get rid of that pesky browserslist warning that throws people off guard sometimes. See it evolve (or crash and burn) here: Ignore Browserslist warning. by linusdm · Pull Request #84 · phoenixframework/tailwind · GitHub
You can actually already set a config value for your tailwind config to supress that warning:

# Configure tailwind (the version is required)
config :tailwind,
  version: "3.2.4",
  default: [
    args: ~w(
      --config=tailwind.config.js
      --input=css/app.css
      --output=../priv/static/assets/app.css
    ),
    cd: Path.expand("../assets", __DIR__),
    env: %{"BROWSERSLIST_IGNORE_OLD_DATA" => "1"}
  ]

Or you can upgrade as was suggested :slight_smile:

Also Liked

arcanemachine

arcanemachine

From what I understand, the procedure to upgrade the Tailwind Hex package (the one that is installed by default in Phoenix >=1.7.0) is as follows:

That being said, I’m not sure if upgrading will produce any unexpected side effects. I upgraded from 3.2.4 to 3.3.2 and all my tests are still passing FWIW.

I posted this here since I couldn’t find the specific noob-level instructions on the subject.

LostKobrakai

LostKobrakai

It doesn’t matter what you do to your local node/npm install. Nothing of that is used.

The only thing you can do is change the version of the tailwind cli being pulled in by phoenix (as mentioned the version is set in your mix config).

LostKobrakai

LostKobrakai

That warnings’s suggested resolution is misleading. With the tailwind CLI everything is bundled in the binary, so there’s no way to update browserlist. The only way to get rid of the warning is to update to a newer tailwind version, which being newer has been built less time in the past.

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New

Other popular topics Top

New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement