我目前正在学习Elixir,通过在elixir-lang网站上浏览OTP和混合教程,我很难找到如何从shell中重新编译和重新加载项目.
在Erlang中我会这样做make:all([load]),它会编译并加载发生的任何更改.然而,iex总是说:up_to_date,这确实有意义,因为Elixir使用mix来满足它的编译需求.
我在iex中找不到任何等价物.
我在我的Homestead流浪盒上运行Laravel 5.4.我用npm install命令安装了所有npm依赖项.这没有产生任何错误.
在我的webpack.min.js文件中,我有:
const { mix } = require('laravel-mix');
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
mix.js([
'resources/assets/plugins/jquery-1.11.3.min.js',
'resources/assets/plugins/bootstrap/js/bootstrap.min.js',
'resources/assets/js/main.js'
], 'public/js'
);
mix.combine([
'resources/assets/plugins/bootstrap/css/bootstrap.min.css',
'resources/assets/plugins/font-awesome/css/font-awesome.css',
'resources/assets/css/styles.css'
], 'public/css/all.css');
Run Code Online (Sandbox Code Playgroud)
当我想要运行时,npm …
我搜索package management上Erlang和Elixir并得到了一些指针rebar rebar3 mix hex和relx等,您可以帮助澄清它们之间的关系?哪里用什么?难道package只是同义词Erlang的application组成的modules?
每次修改源代码时如何自动重新编译和重新加载我的iex + mix应用程序?
如果iex + mix组合无法做到这一点,那么最简单的选择是什么?我已经检查了凤凰的重载方式,对我的小测试项目来说似乎并不容易实现.
我也知道José的.iex.exs:
defmodule R do
def reload! do
Mix.Task.reenable "compile.elixir"
Application.stop(Mix.Project.config[:app])
Mix.Task.run "compile.elixir"
Application.start(Mix.Project.config[:app], :permanent)
end
end
Run Code Online (Sandbox Code Playgroud)
我并不是非常高兴,因为它不会在代码更改时自动重新加载,我仍然需要输入R.reload!iex.
并且..请帮我在stackoverflow上创建"iex"标签,我的声誉还不够:)
在我的Elixir/Phoenix应用程序中,当我跑步时
mix test
Run Code Online (Sandbox Code Playgroud)
我输出如下:
$ mix test
....
Finished in 0.09 seconds
4 tests, 0 failures
Run Code Online (Sandbox Code Playgroud)
每个测试成功的点数.
如何输出成功的测试名称?
在使用rspec的Rails中,我曾经在目录中使用.rspec文件执行此操作,该文件看起来像:
$ cat .rspec
--color
-fd
--tty
Run Code Online (Sandbox Code Playgroud)
Elixir中是否有相同的名称?
有没有办法直接通过命令行使用mix或安装Elixir项目的依赖项mix hex?
我知道hex通过搜索注册表的选项
$ mix hex.search httpoison
Package Version URL
httpoison 0.11.0 https://hex.pm/packages/httpoison
Run Code Online (Sandbox Code Playgroud)
但是,我正在寻找类似的东西
$ mix hex.install httpoison
Run Code Online (Sandbox Code Playgroud)
这将修改我的mix.exs文件,将依赖项的名称和最新版本添加deps到applications列表中,然后运行该应用程序名称
$ mix deps.get
Run Code Online (Sandbox Code Playgroud)
拉取和编译依赖项.
我在我的项目中使用Laravel 5.4并尝试使用Mix设置前端构建系统.一切都工作正常,除了我无法获得浏览器自动重新加载选项.文档上没有任何内容.
有人请帮忙,我该怎么做?
我正在用ES6重新编写我的电子应用程序,使用Laravel Mix编译应用程序JS和SASS.现在,主进程可以很好地加载渲染过程.一旦发生这种情况,我的app.js就会加载,这就是我遇到问题的地方.所以我这样做:
import { remote } from 'electron';
Run Code Online (Sandbox Code Playgroud)
这导致控制台中出现此错误:
Uncaught Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
Run Code Online (Sandbox Code Playgroud)
现在我已经尝试重新安装电子,即使电子在主要过程开始时起作用.该行在编译的js中引用了这个:
/* WEBPACK VAR INJECTION */(function(__dirname) {var fs = __webpack_require__(8)
var path = __webpack_require__(9)
var pathFile = path.join(__dirname, 'path.txt')
if (fs.existsSync(pathFile)) {
module.exports = path.join(__dirname, fs.readFileSync(pathFile, 'utf-8'))
} else {
throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
}
Run Code Online (Sandbox Code Playgroud)
我不确定发生了什么,任何建议或信息都会有很大的帮助!
谢谢
编辑:我试过运行它--verbose:
/Library/Caches/com.apple.xbs/Sources/AppleGVA/AppleGVA-10.1.16/Sources/Slices/Driver/AVD_loader.cpp: failed to get a service for …Run Code Online (Sandbox Code Playgroud) 我正在编写一些与SSH交互的Elixir代码的测试.在我的测试中,我想启动一个SSH服务器,我可以运行我的代码.我更喜欢将此代码存储在测试目录中的自己的文件中,并通过各种不同的测试导入它.
尽管如此,我还是无法让它工作得太好.
我已经尝试创建一个test/ssh_server.ex包含SSHServer模块的文件,但是当我添加import SSHServer到我的测试中时,我得到:
(CompileError)test/end_to_end_test.exs:13:模块SSHServer未加载,无法找到
我错过了什么吗?有没有办法强制mix test导入我的test/ssh_server.ex文件?
我可以使用mix来全局安装一些软件包吗?我想类似行为npm的全局选项或gem的安装-这可能是因为我到处使用像包有用csv或yaml.
elixir-mix ×10
elixir ×7
laravel-5 ×2
ecmascript-6 ×1
electron ×1
erlang ×1
iex ×1
javascript ×1
laravel ×1
laravel-mix ×1
node.js ×1
rebar ×1
relx ×1
testing ×1
verbosity ×1
webpack ×1