#Gleam not seeing StringBuilder

1 messages · Page 1 of 1 (latest)

vital pelican
#

I have this issue with gleam:

===> Compiling thoas
  Compiling gleam_json
error: Unknown module
  ┌─ ...\gleam\app\build\packages\gleam_json\src\gleam\json.gleam:6:1
  │
6 │ import gleam/string_builder.{type StringBuilder}
  │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

No module has been found with the name `gleam/string_builder`.

error: Unknown type
    ┌─ ...\gleam\app\build\packages\gleam_json\src\gleam\json.gleam:141:41
    │
141 │ pub fn to_string_builder(json: Json) -> StringBuilder {
    │                                         ^^^^^^^^^^^^^

The type `StringBuilder` is not defined or imported in this module.

Code:

import gleam/erlang/process
import mist
import wisp
import wisp/wisp_mist

pub fn main() {
  wisp.configure_logger()

  let assert Ok(_) =
  wisp_mist.handler(fn(_) { todo }, "secret_key")
  |> mist.new
  |> mist.port(8000)
  |> mist.start_http

  process.sleep_forever()
}
arctic wing
#

StringBuilder has been removed in newer versions of the standard library. Seems like you need to update your gleam_json dep

vital pelican
#

It should be up to date, I installed gleam today xd

arctic wing
#

The version of the gleam_json dependency has nothing to do with your Gleam version

vital pelican
#

Dosent it pull latest one if i dont specify verision?

arctic wing
#

That depends on your other dependencies

vital pelican
#

oh, i do have gleam_json 1.sth

arctic wing
#

Yeah

#

What does your gleam.toml look like?

vital pelican
#

It works after updating to gleam_json@2

#

Thanks

#

now i need to battle windows again

dire timber
#

Hi @arctic wing, sorry for the direct ping but what if I don't have gleam_json in my deps? How can i trace which other dependency is depending on an outdated version of gleam_json?

#

mmmh ok nvm, i checked the manifest and saw glitch was the only dep on gleam_json 1.*

#

removed it and it now compiles

arctic wing
#

gleam deps tree --invert gleam_json will show you what depends on it

dire timber
#

neat, thank you!