coderrick
coderrick

Reputation: 1011

Cannot generate Phoenix app on Windows

I'm having serious trouble with using Elixir's Phoenix Framework on Windows8. After getting past most of the platform specific bugs an error tells me that rebar cannot be found and did not compile ranch. I've even gone as far as putting rebar in my enviroment path but its still complaining. All in all, what should I do to compile ranch, there is an example of the error below.

Programming PC@PROGRAMMING-PC ~/Documents/GitHub/Elixir/phoenix ((v0.6.1))
$mix phoenix.new newapp ~/newapp
'c:/Program' is not recognized as an internal or external command,
operable program or batch file.
←[31m←[1m** (Mix) Could not compile dependency ranch, c:/Program Files/rebar/reb
ar.cmd command failed. If you want to recompile this dependency, please run: mix
 deps.compile ranch←[0m

Upvotes: 4

Views: 846

Answers (2)

coderrick
coderrick

Reputation: 1011

As suggested by the others the error was caused by a Windows gotcha in my path to rebar. Normally this doesn't cause me any trouble but in this the space in C:/Program Files/rebar was the problem. In order to fix this error I had to replace Program Files with its alias PROGRA~1, which doesn't have a space. After doing this everything compiled without a problem.

Upvotes: 1

Onorio Catenacci
Onorio Catenacci

Reputation: 15293

1.) Make sure you've got rebar in your path.

2.) As @p11y pointed out above, it looks like it's unhappy with the space in the directory name. The simplest fix is to look up the short name equivalent of the path and use that instead. And the easiest way to do that is to use the dir /x command from a command prompt to find out what the equivalent 8.3 name is.

3.) Looking at the prompt above--are you using Cygwin or Mingw32? If so, the path may be different. Make sure you can navigate to the C:/program files/rebar path in the shell you're using.

Upvotes: 3

Related Questions