Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tutorial seat_saver part-2 : Using phoenix 1.1.3, [email protected] and the last elm packages #4

Closed
ggerico opened this issue Jan 24, 2016 · 13 comments

Comments

@ggerico
Copy link

ggerico commented Jan 24, 2016

Hi,

I got this message error in the terminal after starting the server: iex -S mix phoenix.server
error: undefined of web/elm/SeatSaver.elm failed. or: Cannot read property 'path' of undefined

The brunch process succeeded, I can see the Elm script inside the app.js in the priv directory.
But the true is, I should I have done something wrong :(

Any help?

@urfolomeus
Copy link
Contributor

Does the app work when you open it in the browser? I've occasionally seen that error as a race condition between the Elm build finishing and the Brunch process completing. As soon as the Elm build finishes though Brunch recognises the changes and runs again, this time successfully.

@ggerico
Copy link
Author

ggerico commented Jan 24, 2016

Yes, it works.

I have got the message below when I refresh the index page:
[info] GET /
[debug] Processing by SeatSaver.PageController.index/2
Parameters: %{}
Pipelines: [:browser]
[info] Sent 200 in 177µs

But the index source show an empty elm-main div.

@ggerico
Copy link
Author

ggerico commented Jan 24, 2016

Sorry actually the brunch build didn't succeed.
The seatsaver.js is in the vendor directory but NOT imported in the priv/static/js/app.js

@urfolomeus
Copy link
Contributor

OK, thanks. I'll try running the code with the version you mentioned and see if I get the same issue.

@ggerico
Copy link
Author

ggerico commented Jan 24, 2016

thank you ~

@urfolomeus
Copy link
Contributor

It seems to be working for me. Can you share you code please and I'll see if I can spot anything. Thanks :)

@ggerico
Copy link
Author

ggerico commented Jan 25, 2016

It is working! The matter is BRUNCH WATCHED :

  • first in the brunch config file: watched: ["web/static", "test/static", "web/elm/SeatSaver.elm"]
  • then Brunch complains about the path but compiles the files
    Elm compile: SeatSaver.elm, in web/elm, to ../static/vendor/seatsaver.js
    25 Jan 12:02:00 - error: undefined of web/elm/SeatSaver.elm failed. or: Cannot read property 'path' of undefined
    25 Jan 12:02:01 - error: undefined of web/elm/SeatSaver.elm failed. or: Cannot read property 'path' of undefined
  • finally in order to stop Brunch to complain about the path in the brunch config file again: watched: ["web/static", "test/static"]
  • I reload the server and it works

@tobyhede
Copy link

I have the same issue on the latest phoenix while following the tutorial.

Adding and removing "web/elm/SeatSaver.elm" from the watched config in brunch-config.json reproduces this behavior as above.

The file will compile, but the reload fails, then you remove the watcher and the reload works, loading the previously compiled file.

@urfolomeus
Copy link
Contributor

Ah yes, sorry I just realised that I still had the old version of phoenix_new in my mix archive >.<

Upgraded to 1.1.3 and am seeing the same behaviour. I'll take a look at it this evening and try to get to the root of the issue.

Thanks, folks.

@urfolomeus
Copy link
Contributor

OK so a quick update: I've confirmed that it's brunch 2.2.0 where the issue arises. If you downgrade to brunch 2.1.3 everything should work as expected. Will carry on trying to locate the source of the issue.

@urfolomeus
Copy link
Contributor

It looks like the issue is with the elm-brunch plugin that I'm using. Brunch seems to have updated the way that they expect plugins to be written. I raised an issue there and posited a potential fix. Will let you know how I get on. Thanks again for raising. :)

@tobyhede
Copy link

Thanks, 2.1.3 resolved the issue for me.

@urfolomeus
Copy link
Contributor

Hi all,

Apologies for the late reply, been very busy of late. There is now an updated version of elm-brunch (0.4.4) that fixes this issue. I've updated the code in the SeatSaver project to reflect the move to Phoenix 1.1.3 and elm-brunch 0.4.4 and will add a post to the blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants