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

Error when compiling on Windows 7, missing module :cowboy_req #4

Closed
tinat opened this issue Jan 10, 2014 · 6 comments
Closed

Error when compiling on Windows 7, missing module :cowboy_req #4

tinat opened this issue Jan 10, 2014 · 6 comments

Comments

@tinat
Copy link

tinat commented Jan 10, 2014

Hi,
I am encountering this error in Windows 7 with most current master on Elixir (VERSION=0.12.2-dev) .

I ran in the Windows Command Shell prompt:

mix new test_plug
cd test_plug

modified mix.exs to have the following snippets:

def application do
[ applications: [:cowboy, :plug],
mod: { TestPlug, [] }]
end

defp deps do
[ { :cowboy, github: "extend/cowboy" },
{ :plug, github: "elixir-lang/plug" } ]
end

then ran:

mix deps.get

And get the following error:

== Compilation failed ==
Compilation failed on the following files:

  • lib/plug/adapters/cowboy/connection.ex is missing module :cowboy_req
  • lib/plug/adapters/cowboy/handler.ex is missing module :cowboy_req

The first failure is shown below...
== Compilation error on file lib/plug/adapters/cowboy/connection.ex ==
could not compile dependency plug, mix compile failed. You can recompile this dependency with mix deps.compile plug or update it with mix deps.update plug
** (CompileError) deps/plug/lib/plug/adapters/cowboy/connection.ex:5: module :cowboy_req is not loaded and could not be found
(elixir) src/elixir_exp.erl:95: :elixir_exp.expand/2
(stdlib) lists.erl:1339: :lists.mapfoldl/3
(stdlib) lists.erl:1340: :lists.mapfoldl/3
(elixir) src/elixir_exp.erl:43: :elixir_exp.expand/2
(elixir) src/elixir.erl:150: :elixir.quoted_to_erl/3

Thanks!
Tina

@josevalim
Copy link
Member

Thanks Tina! A couple questions:

If you run, mix deps.get cowboy does it work?
What about mix deps.compile cowboy?
Finally, can you see a bunch of .beam files at plug/_build/shared/lib/cowboy/ebin?

@tinat
Copy link
Author

tinat commented Jan 10, 2014

I ran

mix deps.compile cowboy

which worked, but the *.beam files are in test_plug/_build/shared/lib/cowboy/ebin/ebin

Yes, there is a ebin directory UNDER the ebin directory for _build/shared/lib/cowboy, _build/shared/lib/cowlib, and _build/shared/lib/ranch and the beam files are in the nested (second) ebin directory

This is only for Windows -- using Elixir 0.12.2-dev

This does not happen on the Mac (I have both) and using Elixir 0.12.2-dev on both machines. I got some errors when I compiled Elixir 0.12.2-dev on Windows too. I compiled Elixir by clone the repo, and then running msys.bat (as Administrator) in the DevKit directory that came with RailsInstaller2.2.1 and running

make test

I installed Erlang via the otp_win64_R16B02.exe installation

Thanks for your attention. I can do anything testing you need.
Tina

@tinat
Copy link
Author

tinat commented Jan 10, 2014

A little more information, I copied all the beam files from ebin/ebin directory to ebin directory
and then ran

mix deps.compile plug

And that worked

But if I just ran

mix deps.compile cowboy

again, I get the error:

** (File.Error) could not remove files and directories recursively from c:/apps/test_plug/_build/shared/lib/cowboy/ebin: file already exists
(elixir) lib/file.ex:726: File.rm_rf!/1
(mix) lib/mix/utils.ex:334: Mix.Utils.symlink_or_copy/2
(mix) lib/mix/project.ex:278: Mix.Project.build_structure/2
(elixir) lib/file.ex:913: File.cd!/2
(mix) lib/mix/tasks/deps.compile.ex:176: Mix.Tasks.Deps.Compile."-build_structure/2-fun-0-"/3
(elixir) lib/enum.ex:517: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:517: Enum.each/2
(mix) lib/mix/tasks/deps.compile.ex:71: Mix.Tasks.Deps.Compile."-do_run/2-fun-0-"/4

@josevalim
Copy link
Member

It should be fixed in Elixir master. :) I think that you are already using master, so you just need to update your git checkout and do a make clean compile.

Your reports have been a great help, thank you!

@tinat
Copy link
Author

tinat commented Jan 10, 2014

Jose, thanks for the super-duper quick fix. It worked. No more nested ebin directories!

I did have to compile cowboy explicitly. As in:

mix deps.get # fetched all dependencies from git -- got the same error
mix deps.compile cowboy # cowlib and ranch compiled but cowboy was skipped
mix deps.compile plug # Success!

Thanks and thanks for Elixir -- I am enjoying it -- much better than Erlang, especially for a Rubyist like me.

@josevalim
Copy link
Member

Glad to know! Thanks for your help!

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