对于Erlang代码,我使用rebar.对于Elixir代码,我使用内置混合工具.
现在我想要一个混合的Erlang/Elixir项目.我可以使用rebar来编译Elixir代码吗?或者我可以使用mix来编译Erlang代码吗?
如果是这样,怎么样?
我有一个任务在lib/mix/tasks/thing.exs
代码是:
defmodule Mix.Tasks.Thing do
use Mix.Task
def run(_) do
IO.puts "hello world"
end
end
Run Code Online (Sandbox Code Playgroud)
当我跑步mix thing或mix Thing我得到The task thing could not be found或The task Thing could not be found
我mix compile事先尝试过跑步,但没有帮助.
我也尝试将这个问题的代码直接放到我的mix.exs中,如该问题所示.我仍然无法执行任务.
我想在自定义组合任务中运行混合任务.
就像是
def run(_) do
Mix.Shell.cmd("mix edeliver build release")
#do other stuff
Run Code Online (Sandbox Code Playgroud)
但我无法弄清楚如何执行shell命令.如果有更简单的方法(除了制作一个bash脚本),请告诉我.
假设我正在编写一个新模块,代码尚未就绪,我想在repl中测试一些东西.我运行iex -S mix它失败,因为编译错误我还没打算修复.
我认为我的应用程序的最后一个编译版本可以运行iex.我怎么做?
我有一个混合项目,尽可能简单的Supervisor和GenServer.当我从iex打电话时:
EchoCmd.Supervisor.start_link([:Hello])
GenServer.call(:echoserver, :echo)
GenServer.call(:echoserver, :mumble)
GenServer.call(:echoserver, :echo)
Run Code Online (Sandbox Code Playgroud)
:mumble调用引发异常,然后GenServer重新启动,第二个:echo调用正常.
如果我以任何其他方式运行代码,Supervisor将无法重新启动GenServer.例如,我使用主模块创建项目的escript,如下所示:
defmodule EchoCmd.Echo do
def main(args) do
EchoCmd.Supervisor.start_link([:Hello])
GenServer.call(:echoserver, :echo)
GenServer.call(:echoserver, :mumble)
GenServer.call(:echoserver, :echo)
end
end
Run Code Online (Sandbox Code Playgroud)
:mumble调用引发异常,escript终止,而Supervisor没有重启GenServer.
我没有包含Supervisor和Server模块代码,因为它们在从iex调用时工作正常,所以我猜这里不需要它们.
我有一个概念上的误解吗?这不可能,或者我做错了什么?
我想组合音频片段,彼此叠加,以便它们同步播放并保存在新的音频文件中.任何帮助将非常感激.我已经在线进行了一些挖掘工作,但是无法找到关于Javascript音频编辑库(例如)的许多工具是否可用的确切答案.
我对 elixir 和 phoenix(和 ubuntu)很陌生,并且一直在努力让自己启动并运行 Web 开发。使用创建新的凤凰应用程序时
mix phoenix.new webapp
Run Code Online (Sandbox Code Playgroud)
我从终端收到以下错误
Fetch and install dependencies? [Yn] y
* running mix deps.get
* error command failed to execute, please run the following command again after installation: "mix deps.get"
* running npm install && node node_modules/brunch/bin/brunch build
* error command failed to execute, please run the following command again after installation: "npm install && node node_modules/brunch/bin/brunch build"
Run Code Online (Sandbox Code Playgroud)
和跑步时 mix deps.get
结果错误信息是
** (Mix) No package with name phoenix_ecto (from: mix.exs) in registry …Run Code Online (Sandbox Code Playgroud) 我有加载laravel项目,可以在代客域名something.dev上正常运行
试图通过laravel-mix实现浏览器同步
mix.browserSync({
proxy: 'something.dev'
});
Run Code Online (Sandbox Code Playgroud)
运行后,npm run watch它指向我http://localhost:3000/
我可以指向代客域名而不是localhost:3000吗?
这是输出 npm run watch
Asset Size Chunks Chunk Names
mix.js 2.59 kB 0 [emitted] mix
[Browsersync] Proxying: http://something.dev
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.1.131:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://192.168.1.131:3001
--------------------------------------
[Browsersync] Watching files...
Run Code Online (Sandbox Code Playgroud) 在mix.exs你可以声明依赖性,如:
def deps do
[{:plug, "~> 1.0"}]
end
Run Code Online (Sandbox Code Playgroud)
为什么它需要"〜>"而不是简单地在元组的第二部分上的版本.
我已经看到,如果它从git获得依赖,你可以编写依赖,如:
def deps do
[{:plug, git: "git://github.com/elixir-lang/plug.git"}]
end
Run Code Online (Sandbox Code Playgroud) 当我做
mix compile
Run Code Online (Sandbox Code Playgroud)
我收到类似的消息
warning: variable "test_val" is unused
lib/myapp/mymodule.ex:46
Run Code Online (Sandbox Code Playgroud)
我只是在做一个业余项目,暂时不关心这些警告。有办法关掉它吗?
elixir-mix ×10
elixir ×8
audio ×1
build ×1
erlang ×1
erlang-otp ×1
gen-server ×1
iex ×1
javascript ×1
laravel ×1
npm ×1
postgresql ×1
rebar ×1