Import module from src directory in elm-repl

422 views
Skip to first unread message

Julian

unread,
May 26, 2016, 9:01:48 AM5/26/16
to Elm Discuss
Hi!

I just started working on my first elm app after a year or so of lurking the elm community.

I have written a few functions and put them into a module located in my `src` directory and everything compiles fine. But when I start elm-repl from the root of my project (where the `elm-stuff` folder is located, I'm unable to load my module...

If I cd into the `src` folder before running the repl, it seems it is able to import my module (by typing `import MyModule` but it complains about not being able to find the dependencies (which is located in `../elm-stuff/`).

Any ideas on how I can run my module in the repl?

Thanks!

Max Goldstein

unread,
May 26, 2016, 10:26:46 AM5/26/16
to Elm Discuss
Have a look at elm-package.json. It lists the source directories, and probably had . instead of ./src.

Shump

unread,
May 27, 2016, 8:20:59 AM5/27/16
to Elm Discuss
My elm-package.json has the following entry:
    ...
    "source-directories": [
       
"src"
   
],
    ...

and my directory looks like this (minus elm-stuff folder in the root)
.
├── build
  └── MyModule.js
├── elm-package.json
├── index.html
└── src
   
└── MyModule.elm

and I try to launch elm-repl from the root with no parameters. In the repl I try to import with `import MyModule` which reports:
elm-make: elm-stuff/build-artifacts/0.17.0/user/project/1.0.0/Repl.elmo: openFile: does not exist (No such file or directory)

Nick H

unread,
May 27, 2016, 3:45:27 PM5/27/16
to elm-d...@googlegroups.com
Three questions:

1. What happens if you run

rm -rf elm-stuff/build-artifacts

And then try elm-repl again?

2. Would you mind sharing your entire elm-package.json?

3. Is 0.17 the only version of Elm you have installed?

I wasn't able to reproduce your problem, so I am just trying to get more info.


--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Shump

unread,
May 30, 2016, 7:56:27 AM5/30/16
to Elm Discuss
Hi Nick!

I got curious when you said that you couldn't reproduce the problem so I tried to do the same in another folder, and I was unable to reproduce the problem as well. After spending some time in my main project, removing lines to narrow down the problem, I managed to get my main project to work with the repl! I'm still not sure what broke and why, but it seems it got fixed when I removed the elm-stuff folder. I suppose there were some cache somewhere screwing with the repl :/

Thank you all for trying to help!
Reply all
Reply to author
Forward
0 new messages