How to downgrade phoenix liveView js asset version to 0.20.17?

I am currently seeing the following log in the the browser console:

LiveView assert version mismatch. Javascript version 1.0.0-rc.6 vs. server 0.20.17. To avoid issues, please ensure that your assets use the same version as the server.

How do I downgrade the javascript assets version to 0.20.17?

What LiveView version do you have in your mix.exs? A clean build/redeploy should realign your asset version.

The mix file has version 0.20.17

{:phoenix_live_view, "~> 0.20.17"},

I’d do a mix deps.get to make sure your dependencies under /deps are aligned with mix.exs, and then a mix assets.build to rebuild your JS bundle.

If that’s not enough, clean potentially stale files from /_build using mix clean --deps.

Another thing that might be at play is browser cache. If you’re developing your app, you can clear the cache for localhost or open the dev tools in your browser and disable cache.

Also make sure whatever bundler you’re using is not caching the js of phoenix code somewhere.

@rhcarvalho Thank you for your suggestions but none of them work.

@LostKobrakai I am using the default esbuild installed by phoenix.

Fixed by specifying the path to the phoenix live view import.
Replaced

import {LiveSocket} from "phoenix_live_view"

with

import {LiveSocket} from "../../deps/phoenix_live_view"

Had this problem but in the other way around, upgraded to lv 1.0.3 and javascript was complaining about being on 0.20.17. Fixed it by just deleting the files inside /priv/assets/ and rebuilding assets by mix assets.build in case anyone has the same problem.

1 Like