lustre-labs / lustre

A Gleam web framework for building HTML templates, single page applications, and real-time server components.
https://hexdocs.pm/lustre
MIT License
1.19k stars 76 forks source link

Can't run tutorial example #168

Closed hlorellium closed 3 months ago

hlorellium commented 3 months ago

Unable to run Lustre program on macOS following quickstart guide

Description

I'm following the Lustre quickstart guide but encountering issues when trying to run the program on macOS.

Environment

Steps to Reproduce

  1. Followed the quickstart guide at https://hexdocs.pm/lustre/guide/01-quickstart.html
  2. Attempted to run the program

Expected Behavior

The program should run successfully as described in the quickstart guide.

Actual Behavior

Encountering errors when trying to run the program.

Error Messages and Screenshots

  1. gleam.toml: gleam.toml

  2. app.gleam: app.gleam

  3. Result of gleam run: Gleam run result

  4. Result of running watch command: Result of running watch command Additional error info 2

Request for Assistance

I would appreciate any help with this!

hayleigh-dot-dev commented 3 months ago

My guess is that you don’t have a C compiler available?

hlorellium commented 3 months ago

I think macOS for default includes clang when installing dev tools, but just to be sure installed it separately and don't think the problem is with that. Ran the command with set debug variable:

===> Not adding provider hex publish from module rebar3_hex_publish because it already exists from module rebar3_hex_publish ===> Running provider: {bare,compile} ===> Compile (untagged) ===> Running hooks for compile in app fs (/Users/hlorella/code/test/app/build/dev/erlang/fs) with configuration: ===> Setting paths to [plugins] ===> {provider_hooks, [{pre, [{pc,compile}]}]}. ===> Running provider: {pc,compile} ===> Uncaught error in rebar_core. Run with DIAGNOSTIC=1 to see stacktrace or consult rebar3.crashdump ===> Uncaught error: {badrecord,not_found} ===> Stack trace to the error location: [{providers,do,2, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/vendor/providers/src/providers.erl"}, {line,90}]}, {rebar_core,do,2, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_core.erl"}, {line,155}]}, {rebar_hooks,run_providerhooks,6, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_hooks.erl"}, {line,70}]}, {rebar_hooks,run_all_hooks,6, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_hooks.erl"}, {line,18}]}, {rebar_prv_compile,'-compile/4-lc$^0/1-0-',3, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_prv_compile.erl"}, {line,152}]}, {rebar_prv_compile,compile,4, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_prv_compile.erl"}, {line,152}]}, {rebar_prv_compile,compile,3, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_prv_compile.erl"}, {line,143}]}, {rebar_prv_bare_compile,do,1, [{file,"/private/tmp/rebar3-20240410-5267-d1j87f/rebar3-3.23.0/apps/rebar/src/rebar_prv_bare_compile.erl"}, {line,71}]}] ===> When submitting a bug report, please include the output of rebar3 report "your command" error: Shell command failure

There was a problem when running the shell command rebar3.

image

hayleigh-dot-dev commented 3 months ago

Seems like you are running into the same issue as reported here: https://github.com/erlang/rebar3/issues/2779

For context what you're seeing right now is not really a Lustre or Gleam issue. Lustre dev tools depends on an erlang package called fs which in turn depends on some native C code. pc is a plugin for rebar3, the erlang build tool, that is used to compile these native C bits and for whatever reason that's tripping you up.

In the linked issue above they mentioned compiling rebar from source and adding it to their PATH resolved their issue. Doesn't seem ideal but it might be worth trying; how did you install erlang - I noticed you're on otp 27 which is not yet available through homebrew.

hlorellium commented 3 months ago

Seems like that is some issue when running with otp 27, downgraded to 26 and it worked. Installed it using https://github.com/jdx/mise

hayleigh-dot-dev commented 3 months ago

Super weird, glad you got it solved!