kleinernik

kleinernik

`Jason.Encoder is not available, cannot derive Jason.Encoder` using `mix compile.elixir`

Hi,

I am trying out the script from dashbits new blogpost Rewriting imports to aliases with compilation tracers - Dashbit Blog on my project.

They use the compile.elixir task in there. I can’t get this task to run on my project, while mix compile runs just fine. The errors I keep getting with compile.elixir all are ** (ArgumentError) Jason.Encoder is not available, cannot derive Jason.Encoder at various places in my code where I derive Jason.Encoder.

Anybody got any idea if this is expected behavior, an error on my side or a bug?

Most Liked

kleinernik

kleinernik

In case someone runs into the same problems I have run into:

  1. If you derive Protocols of external dependencies like Jason.Encoder, for compile.elixir to work, you need to first run mix compile.protocols
  2. Unlike stated here Rewriting imports to aliases with compilation tracers - Dashbit Blog, it seems like you need to use mix run import2alias.exs ... instead of elixir import2alias.exs ... otherwise the will be no mix environment (af far as I understand) and you’ll get this error: ** (exit) exited in: GenServer.call(Mix.ProjectStack, {:get_stack, #Function<10.68469381/1 in Mix.ProjectStack.peek/0>}, :infinity). At least that worked for me.

Where Next?

Trending in Questions Top

hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
clemensm
Hi everyone We’ve got a rather heavy SPA written with LiveView. The main “window” is a LiveView, and for historical reasons some of the ...
New
gtcode
Aloha gang, I’m working on a port of Sakana AI’s TRINITY, an evolved LLM coordinator: TRINITY Paper OpenReview Downloadable Assets I...
New
silverdr
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated! To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead. Sta...
New
saveman71
Hello ! We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New

Other Trending Topics Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2976 91332 914
New
kip
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jola
I’ve been bumping into some rough edges recently with Elixir dependencies that use app config and start their own supervision trees and I...
New
quatermain
Hello, I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself. I use Claude Code daily on a pr...
New

We're in Beta

About us Mission Statement