When I create new projects from scratch everything works great (going through the PragPro programming Phoenix book).
mix phoenix.new foo
works every time. Hooray.
But, I have just encountered an issue after I started tracking the project with git (I am pretty sure I forgot to track a file(s)). When I cloned the code on a new VM I am getting errors:
warning: function Foo.Repo.all/1 is undefined (module Foo.Repo is not available)
** (Mix) Could not load Foo.Repo, error: :nofile. Please configure your app accordingly or pass a repo with the -r option.
iex -S mix:
** (Mix) Could not start application validere: exited in: Foo.start(:normal, )
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Foo.start/2 is undefined (module Foo is not available)
(kernel) application_master.erl:273: :application_master.start_it_old/4
in my foo/config dir I have all four (config, dev, prod, test). I am pretty sure I just forgot some files. What I was hoping to find is a way to turn on verbose (or something) for the iex startup. Like step through the startup code till it barfs. Needless to say I am very new to elixir, phoenix and I have not yet had a chance to get up to date with the debugging tools. Sorry if this is a silly question (my brain is very frustrated and fatigued). I am going to try to create a foo2 and do a dir/file diff for now.
In your VM with your git cloned code, did you try running
mix do deps.get, deps.compile?
And I’m assuming you’re running as MIX_ENV=dev
Otherwise, if you’re using MIX_ENV=prod, check that your config/prod.exs file exists and has the relevant settings, and that config/prod.secrets.exs exists and also has the relevant settings.
The usual culprit when running in MIX_ENV=prod is missing config/prod.secrets.exs as this file is in .gitignore and never gets staged and pushed into github. Primary reason is security concerns with prod config secrets leaving into source control system that might pose a security threat.
well, if you feel as if files are missing in the git tree, then you should give us what you actually have. Since you say it’s grown as you read the book I assume its nothing you need to hide. So best way to get support here is to push the repository publicly to github, gitlab, bitbucket, or similar services and share the link.
From a first glance it seems as if complete src were missing.
Oh and after you created that public repo, please post the output of
git status in the directory where your working copy of the project lives.
Thanks for the quick replies @yeongsheng and @NobbZ. I am 100% certain its missing files. Earlier in the day on the original repo I had done a
git clean -f -d to clean up things so that I was only putting a bare minimum of files into git. In my sleep deprived state when I was asking for help I spaced on that one. I can’t publish the files because this is an early stage of a commercial product (the MVC files would give it away). I was just using “Foo” as a example. Its all good. Thanks!
Well that command deletes everything which is untracked… You will have to recreate all this files from scratch.