Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows: Elixir phoenix MIX_ENV=prod : The term is not recognized

Just started to learn elixir and phoenix framework. for the most part it going well. However when I want to run ecto.create on my production configs, I get an error in my cmd & powershell that MIX_ENV=prod : The term is not recognized. Just in general though MIX_ENV=Xyz doesn't work for me.

I've made a fresh new phoenix project to see if it was a compile problem. wasn't that.

Working on windows.

MIX_ENV=prod : The term 'MIX_ENV=prod' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + MIX_ENV=prod mix phoenix.server + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (MIX_ENV=prod:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Any thoughts what would make a important function stop working?

phoenix,1.1.4

Elixir 1.2.1

Erlang/OTP 18 [erts-7.2.1] [64-bit] [smp:4:4] [async-threads:10]

like image 587
Martin Smith Avatar asked Feb 17 '16 18:02

Martin Smith


1 Answers

MIX_ENV is an environment variable and you just need to set it. Powershell does that differently than a *nix shell, so the examples that show putting MIX_ENV=prod in line with the mix command won't work.

Use $env:MIX_ENV="prod" to set the environment variable and then call the rest of the mix command line.

like image 180
CoderDennis Avatar answered Oct 31 '22 16:10

CoderDennis