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

Elm is not defined.. #9

Closed
ramstein74 opened this issue Mar 30, 2016 · 29 comments
Closed

Elm is not defined.. #9

ramstein74 opened this issue Mar 30, 2016 · 29 comments

Comments

@ramstein74
Copy link

Hello i cloned your repo and i got an error
app.js [sm]:28 Uncaught ReferenceError: Elm is not defined
at this line..
, elmApp = Elm.embed(Elm.SeatSaver, elmDiv, initialState);

please help..
thank you

@urfolomeus
Copy link
Contributor

Hi Antonio,

I've added a set of instructions to the README under the tutorials section that should help you to get running without going through the tutorials. Can you let me know if this helps please?

Thanks.

@ramstein74
Copy link
Author

not exactly.
still the same error.
I looked inside vendor folder and its empty..

2016-03-30 16:37 GMT+01:00 Alan Gardner notifications@github.com:

Hi Antonio,

I've added a set of instructions to the README under the tutorials section
that should help you to get running without going through the tutorials.
Can you let me know if this helps please?

Thanks.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

Can you paste the log out put from iex -S mix phoenix.server please? It looks like something is stopping brunch from compiling the SeatSaver.elm file.

@ramstein74
Copy link
Author

[image: Imagem inline 1]
does this help?

2016-03-30 16:51 GMT+01:00 Alan Gardner notifications@github.com:

Can you paste the log out put from iex -S pmix phoenix.server please? It
looks like something is stopping brunch from compiling the SeatSaver.elm
file.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

Sorry Antonio, I'm not seeing that image. Just seeing [image: Imagem inline 1].

@ramstein74
Copy link
Author

here it is...
image

@urfolomeus
Copy link
Contributor

Hmm, I wonder if this has something to do with running on Windows. I've not tried running the app there yet. I'll give that a try shortly and let you know. Thanks.

@ramstein74
Copy link
Author

Many thanks..

2016-03-31 10:19 GMT+01:00 Alan Gardner notifications@github.com:

Hmm, I wonder if this has something to do with running on Windows. I've
not tried running the app there yet. I'll give that a try shortly and let
you know. Thanks.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

Hi Antonio,

I've managed to replicate this on my Windows desktop and believe that it is down to this issue with elm-brunch (which I use for compiling the Elm files) madsflensted/elm-brunch#16.

If you change the brunch_config file as follows then this should get you up an running.

plugins: {
  elmBrunch: {
    elmFolder: 'web\\elm',
    mainModules: ['SeatSaver.elm'],
    outputFolder: '..\\static\\vendor'
  },
  ...
},

Thanks for raising this. I'll add a note to the README until I have time to run the tutorial on Windows.

@ramstein74
Copy link
Author

Thank you but still a litle more help needed
image

@urfolomeus
Copy link
Contributor

If you do the following this should clear that error:

# from the root of the project
cd web/elm
elm package install -y
cd ../..

@ramstein74
Copy link
Author

not my day..

image

@urfolomeus
Copy link
Contributor

Hmm, I'm a bit stuck now I have to confess. It looks like it might be more than Elm that you are having issues with.

What packages are installed in your web\elm\elm-stuff\packages\evancz folder?

@ramstein74
Copy link
Author

I have elm\elm-stuff\packages
and this last folder is "EMPTY!"

2016-03-31 13:13 GMT+01:00 Alan Gardner notifications@github.com:

Hmm, I'm a bit stuck now I have to confess. It looks like it might be more
than Elm that you are having issues with.

What packages are installed in your web\elm\elm-stuff\packages\evancz
folder?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

Well that certainly explains why it can't find the package! :)

Can you try running elm package install without the -y flag and see if we get any clues please?

@ramstein74
Copy link
Author

image

but the folder packages inside elm-stuff continues empty..

@urfolomeus
Copy link
Contributor

Oh, that's weird. What's in your web\elm\elm-package.json file?

@ramstein74
Copy link
Author

{
"version": "1.0.0",
"summary": "helpful summary of your project, less than 80 characters",
"repository": "https://github.com/user/project.git",
"license": "BSD3",
"source-directories": [
"."
],
"exposed-modules": [],
"dependencies": {
"elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-effects": "2.0.1 <= v < 3.0.0",
"evancz/elm-html": "4.0.2 <= v < 5.0.0",
"evancz/start-app": "2.0.2 <= v < 3.0.0"
},
"elm-version": "0.16.0 <= v < 0.17.0"
}

2016-03-31 13:45 GMT+01:00 Alan Gardner notifications@github.com:

Oh, that's weird. What's in your web\elm\elm-package.json file?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

OK, now I'm stumped. Running elm package install in a directory with an elm-package.json file should install the elm packages denoted in that file (much in the same way npm does with package.json). I'm not sure why you wouldn't be getting either:

  1. those packages installed or
  2. some kind of error

Only thing I can think of is that elm is installing the packages elsewhere. Do you have an elm-stuff folder anywhere else on the project (such as the project root directory perhaps)?

@urfolomeus
Copy link
Contributor

One other thought occurs ... are you behind a proxy or firewall of some sort? I would have still expected an error but haven't tried running the elm package installer in those conditions.

@ramstein74
Copy link
Author

yes behind a proxy and firewall but never had problem with npm or others...
should i do
elm-package install elm-lang/core
etc...

2016-03-31 13:54 GMT+01:00 Alan Gardner notifications@github.com:

One other thought occurs ... are you behind a proxy or firewall of some
sort? I would have still expected an error but haven't tried running the
elm package installer in those conditions.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

You could certainly give it a shot. Might be worthwhile trying to start from scratch with http://www.cultivatehq.com/posts/phoenix-elm-1 and http://www.cultivatehq.com/posts/phoenix-elm-2. That would take you as far as a basic Phoenix/Elm setup.

I'm currently going through and updating the posts with Windows-specific gotchas.

@urfolomeus
Copy link
Contributor

Perhaps this might be related? elm-lang/elm-package#149

@ramstein74
Copy link
Author

thats it.
Solved about the elm issue. I installed it again via
npm -g install elm
i had 0.15 and installed 0.16.
Solved it.

Now to the browser.
i already did this
mix ecto.create && mix ecto.migrate && mix run priv/repo/seeds.exs

but this is what i see...
image

this time no errors in web console nor on iex cmd line

@urfolomeus
Copy link
Contributor

Try mix run priv\repo\seeds.exs ;)

@ramstein74
Copy link
Author

Did that.
also via pgadmin i see many records but the web screen is empty..
sorry to disturb you . You have been a great help so far..

António

2016-03-31 15:26 GMT+01:00 Alan Gardner notifications@github.com:

Try mix run priv\repo\seeds.exs ;)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@ramstein74
Copy link
Author

Nothing is being injected in the html page at

i tried
changing the code of seatsaver.elm to just

module SeatSaver where

import Html exposing (text)

main =
text "Hello, World!"

and the same empty result...

2016-03-31 16:19 GMT+01:00 António Ramos ramstein74@gmail.com:

Did that.
also via pgadmin i see many records but the web screen is empty..
sorry to disturb you . You have been a great help so far..

António

2016-03-31 15:26 GMT+01:00 Alan Gardner notifications@github.com:

Try mix run priv\repo\seeds.exs ;)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@ramstein74
Copy link
Author

I found the problem.
It all works now.

Seems that the brunch config on windows should use / instead of \ or // .
I dont know if that could be a rule for all but dont care. IT works.

here is my working brunch config

exports.config = {
// See http://brunch.io/#documentation for docs.
files: {
javascripts: {
joinTo: "js/app.js"

  // To use a separate vendor.js bundle, specify two files path
  // https://github.com/brunch/brunch/blob/stable/docs/config.md#files
  // joinTo: {
  //  "js/app.js": /^(web\/static\/js)/,
  //  "js/vendor.js": /^(web\/static\/vendor)|(deps)/
  // }
  //
  // To change the order of concatenation of files, explicitly mention

here
// https://github.com/brunch/brunch/tree/master/docs#concatenation
// order: {
// before: [
// "web/static/vendor/js/jquery-2.1.1.js",
// "web/static/vendor/js/bootstrap.min.js"
// ]
// }
},
stylesheets: {
joinTo: "css/app.css"
},
templates: {
joinTo: "js/app.js"
}
},

conventions: {
// This option sets where we should place non-css and non-js assets in.
// By default, we set this to "/web/static/assets". Files in this
directory
// will be copied to paths.public, which is "priv/static" by default.
assets: /^(web/static/assets)/
},

// Phoenix paths configuration
paths: {
// Dependencies and current project directories to watch
watched: [
"web/static",
"test/static",
"web/elm/SeatSaver.elm"
],

// Where to compile files to
public: "priv\/static"

},

// Configure your plugins
plugins: {
elmBrunch: {
elmFolder: 'web/elm',
mainModules: ['SeatSaver.elm'],
outputFolder: '../static/vendor'
},
babel: {
// Do not use ES6 compiler in vendor code
ignore: [/web/static/vendor/]
}
},

modules: {
autoRequire: {
"js/app.js": ["web/static/js/app"]
}
},

npm: {
enabled: true,
// Whitelist the npm deps to be pulled in as front-end assets.
// All other deps in package.json will be excluded from the bundle.
whitelist: ["phoenix", "phoenix_html"]
}
};

2016-03-31 16:34 GMT+01:00 António Ramos ramstein74@gmail.com:

Nothing is being injected in the html page at

i tried
changing the code of seatsaver.elm to just

module SeatSaver where

import Html exposing (text)

main =
text "Hello, World!"

and the same empty result...

2016-03-31 16:19 GMT+01:00 António Ramos ramstein74@gmail.com:

Did that.
also via pgadmin i see many records but the web screen is empty..
sorry to disturb you . You have been a great help so far..

António

2016-03-31 15:26 GMT+01:00 Alan Gardner notifications@github.com:

Try mix run priv\repo\seeds.exs ;)


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#9 (comment)

@urfolomeus
Copy link
Contributor

\o/ excellent! Thanks again for bringing this to my attention. I've updated the posts to add some Windows pointers and hope to have them released soon. I'll add your note above about \/ instead of \\.

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

2 participants