ydg33

ydg33

Hello!

I’m trying to set up a small Elixir app that depends on jason via another package. Using mix release works, but as soon as I set MIX_ENV=prod I get one of the following errors, nondeterministically:

→ MIX_ENV=prod mix release
==> jason
Compiling 10 files (.ex)

== Compilation error in file lib/encode.ex ==
** (SyntaxError) invalid syntax found on lib/encode.ex:318:57:
     error: unexpected token: "\" (column 57, code point U+005C)
     │
 318 │   slash_escapes = Enum.zip(~c"\b\t\n\f\r\\"\\", ~c"btnfr\"\\")
     │                                                         ^
     │
     └─ lib/encode.ex:318:57
    (elixir 1.16.0) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
could not compile dependency :jason, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile jason --force", update it with "mix deps.update jason" or clean it with "mix deps.clean jason"
→ MIX_ENV=prod mix release
==> jason
Compiling 10 files (.ex)

== Compilation error in file lib/decoder.ex ==
** (SyntaxError) invalid syntax found on lib/decoder.ex:825:24:
     error: unexpected token: "\" (column 24, code point U+005C)
     │
 825 │        when byte in ~c"\s\n\r\t" do
     │                        ^
     │
     └─ lib/decoder.ex:825:24
    (elixir 1.16.0) lib/kernel/parallel_compiler.ex:428: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
could not compile dependency :jason, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile jason --force", update it with "mix deps.update jason" or clean it with "mix deps.clean jason"

I’ve looked at the code in jason and it looks innocuous:

  slash_escapes = Enum.zip(~c"\b\t\n\f\r\\"\\", ~c"btnfr\"\\")

Does MIX_ENV=prod change something about the Elixir language?

Showing Posts 1 to 6

hubertlepicki

hubertlepicki

@ydg33 I don’t know what the problem is, but what’s the verison of Jason that is being pulled in? Also, I can see Elixir 1.16.0, but what about Erlang?

arcanemachine

arcanemachine

My first step when weird stuff like this happens is to delete the _build directory and try again.

Also, what version of Erlang OTP are you using? Does the error still occur if you use a newer/older version of OTP? How about an older version of Elixir? Which platform are you on? (Linux, Mac, Windows)

hubertlepicki

hubertlepicki

Also Jason, if it’s being pulled by some library it may require an old version, and installing, oven with override: true to use newer version may solve it.

ydg33

ydg33 OP

Thanks both for the reply! Sorry for not including the version numbers @hubertlepicki.

Erlang/OTP 26 [erts-14.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Elixir 1.16.0 (compiled with Erlang/OTP 26)

deps/jason/mix.exs says it’s 1.4.1. I’m on macOS.

However, I tried @arcanemachine’s suggestion of rm -rf _build and bizarrely it worked! Very strange. It’s good to know but I wonder how that situation happened.

Also thanks for the tip about using override: true, will remember that!

arcanemachine

arcanemachine

Glad that helped. I literally had the same thing happen yesterday. (It’s not a common occurrence, but it has happened to me before.)

sodapopcan

sodapopcan

You will have an improved QOL if you don’t wonder such things :upside_down_face:

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews