Crowdhailer
How to get gleam standard library to work in a mix project
I have followed this guide on adding Gleam to an Elixir project.
I’ve tweaked it somewhat as I am adding to a pure Elixir project, no phoenix.
Gleam code written in my project works but I am not able to get any gleam libraries to work.
This unfortunately includes the Gleam standard library.
I suspect there is some mix option that says I need to use the compilers for the libraries, but can’t work it out.
Here is the exact version of the code I am trying to run GitHub - midas-framework/elixir_with_gleam: Running Gleam in a mix project. · GitHub
Running mix compile gives the following error.
error: Unknown import
┌── /opt/app/src/hello.gleam:1:8 ───
│
1 │ import gleam/string
│ ^^^^^^^^^^^^ did you mean `hello`?
│
The module `hello` is trying to import the module `gleam/string`,
but it cannot be found.
Marked As Solved
lpil
Thanks for this, super cool!
I’ve packaged up this idea into a tiny library to make it easier to use Gleam from Elixir in future → GitHub - gleam-lang/mix_gleam: ⚗️ Build Gleam code with mix · GitHub
Also Liked
Crowdhailer
I got it working.
Here is an example project.
Crowdhailer
Great.
I’ve also updated GitHub - midas-framework/elixir_with_gleam: Running Gleam in a mix project. · GitHub to reflect the changes
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









