ariandanim

ariandanim

I am using Windows 11, with Elixir 1.17.3 and Erlang 27.1, tried make encryption auth using bcrypt but still not working, here the code error below when trying create new account :

[debug] HANDLE EVENT "save" in EventflowWeb.UserRegistrationLive
  Parameters: %{"_csrf_token" => "NgA1axEPDzodO1goMgsAMBohGQ4pBBsAEK_1GICryH7FpJLREraOftH9", "user" => %{"email" => "test@gmail.com", "password" => "[FILTERED]"}}
[debug] QUERY OK source="users" db=0.1ms queue=0.1ms idle=1803.9ms
SELECT 1 FROM "users" AS u0 WHERE (u0."email" = ?) LIMIT 1 ["test@gmail.com"]
↳ Ecto.Changeset.unsafe_validate_unique/4, at: lib/ecto/changeset.ex:2700
[error] Process #PID<0.828.0> raised an exception
** (RuntimeError) An error occurred when loading Bcrypt.
Make sure you have a C compiler and Erlang 20 installed.
If you are not using Erlang 20, either upgrade to Erlang 20 or
use version 0.12 of bcrypt_elixir.
See the Comeonin wiki for more information.

    (bcrypt_elixir 3.2.0) lib/bcrypt/base.ex:15: Bcrypt.Base.init/0
    (kernel 10.1) code_server.erl:1356: anonymous fn/1 in :code_server.handle_on_load/5
[warning] The on_load function for module Elixir.Bcrypt.Base returned:
{%RuntimeError{
   message: "An error occurred when loading Bcrypt.\nMake sure you have a C compiler and Erlang 20 installed.\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\nuse version 0.12 of bcrypt_elixir.\nSee the Comeonin wiki for more information.\n"
 },
 [
   {Bcrypt.Base, :init, 0,
    [file: ~c"lib/bcrypt/base.ex", line: 15, error_info: %{...}]},
   {:code_server, :"-handle_on_load/5-fun-0-", 1,
    [file: ~c"code_server.erl", line: 1356]}
 ]}

[error] GenServer #PID<0.630.0> terminating
** (UndefinedFunctionError) function Bcrypt.Base.gen_salt/2 is undefined (module Bcrypt.Base is not available)
    (bcrypt_elixir 3.2.0) Bcrypt.Base.gen_salt(12, false)
    (bcrypt_elixir 3.2.0) lib/bcrypt.ex:77: Bcrypt.hash_pwd_salt/2
    (eventflow 0.1.0) lib/eventflow/users/user.ex:76: Eventflow.Users.User.maybe_hash_password/2
    (eventflow 0.1.0) lib/eventflow/users.ex:79: Eventflow.Users.register_user/1
    (eventflow 0.1.0) lib/eventflow_web/live/user_registration_live.ex:57: EventflowWeb.UserRegistrationLive.handle_event/3
    (phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:508: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
    (telemetry 1.2.1) c:/Users/Ariandani/app/phoenix/eventflow/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (phoenix_live_view 1.0.0-rc.6) lib/phoenix_live_view/channel.ex:260: Phoenix.LiveView.Channel.handle_info/2
    (stdlib 6.1) gen_server.erl:2345: :gen_server.try_handle_info/3
    (stdlib 6.1) gen_server.erl:2433: :gen_server.handle_msg/6
    (stdlib 6.1) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F__O4w2TMQDsaRDD", event: "event", payload: %{"event" => "save", "type" => "form", "value" => "_csrf_token=NgA1axEPDzodO1goMgsAMBohGQ4pBBsAEK_1GICryH7FpJLREraOftH9&user%5Bemail%5D=test%40gmail.com&user%5Bpassword%5D=testgmail123"}, ref: "33", join_ref: "16"}
State: %{socket: #Phoenix.LiveView.Socket<id: "phx-F__O4w2TMQDsaRDD", endpoint: EventflowWeb.Endpoint, view: EventflowWeb.UserRegistrationLive, parent_pid: nil, root_pid: #PID<0.630.0>, router: EventflowWeb.Router, assigns: %{form: nil, __changed__: %{}, current_user: nil, flash: %{}, live_action: :new, trigger_submit: false, check_errors: false}, transport_pid: #PID<0.623.0>, ...>, components: {%{}, %{}, 1}, topic: "lv:phx-F__O4w2TMQDsaRDD", serializer: Phoenix.Socket.V2.JSONSerializer, join_ref: "16", upload_names: %{}, upload_pids: %{}}
[debug] MOUNT EventflowWeb.UserRegistrationLive
  Parameters: %{}
  Session: %{"_csrf_token" => "sKjZVFLHdsonBALb_SxAOpS9"}
[debug] Replied in 1ms
[debug] HANDLE EVENT "validate" in EventflowWeb.UserRegistrationLive
  Parameters: %{"_csrf_token" => "NgA1axEPDzodO1goMgsAMBohGQ4pBBsAEK_1GICryH7FpJLREraOftH9", "_target" => ["user", "email"], "user" => %{"_unused_email" => "", "_unused_password" => "[FILTERED]", "email" => "test@gmail.com", "password" => "[FILTERED]"}}
[debug] Replied in 204µs

I am also install all c++ compiler in visual studio tools completed (almost GB file)

here some source code i forked :
https://github.com/rizafahmi/eventflow

Showing Posts 1 to 6

NobbZ

NobbZ

The comeonin README already warns windows users that they will have problems using bcrypt and argon2 and suggest to use pbkdf2 which has no NIF dependencies.

https://github.com/riverrun/comeonin#windows-users

mikejm

mikejm

If you are just developing on Windows but that is not your deployment target, you can run Ubuntu from Windows very easily using “WSL”

See

https://documentation.ubuntu.com/wsl/en/latest/guides/install-ubuntu-wsl2/

That is how I operate these days. Too many packages for Elixir won’t work on Windows.

StepSanch

StepSanch

I’m facing the same issue on my Windows 11 environment. Before compiling Bcrypt on Windows, you need to configure your development environment.

To do this, in the same shell where you’ll be compiling, run the following command: cmd /K “C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat” -arch=x64. This command sets up your shell. The path needs to be customized to reflect your specific installation.

You should also consider removing the previous version of Bcrypt in your _build/dev/lib (if it wasn’t compiled correctly) or force the compilation with the command ‘mix deps.compile bcrypt_elixir --force’.

mitkins

mitkins

I’ve compiled bcrypt on Windows before - but the process is not fun. Once bcrypt is compiled, you’ll forget all about it - until you upgrade or move to a new PC. Then you’ll have to do it all over again!

On a Windows machine, if you create a new Phoenix project and then run:

mix phx.gen.auth

It will use pbkdf2 instead of bcrypt. In the generated code the pdkdf2 calls are identical to their bcrypt counterparts (same function names/signatures).

ariandanim

ariandanim OP

Does both of them has pro n cons ?

mitkins

mitkins

There’s mention of the three libraries here:

Which also refers to the README on Comonin. Further digging reveals:

The long and the short of it is - consider using Argon2 (which requires more memory) and that bcrypt and pdkdf2 are comparable (but more susceptable to GPU attacks)

— 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
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
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
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
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
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
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
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