"undefined function defexception" Error on Elixir app compilation - erlang

While compiling one app, i am getting below error
==> dynamo
Compiled lib/dynamo/base.ex
Compiled lib/dynamo/connection/behaviour.ex
== Compilation error on file lib/dynamo/connection/query_parser.ex ==
** (CompileError) lib/dynamo/connection/query_parser.ex:2: undefined function defexception/2
(elixir) src/elixir.erl:188: :elixir.quoted_to_erl/3
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
(elixir) src/elixir.erl:156: :elixir.erl_eval/2
could not compile dependency dynamo, mix compile failed. You can recompile this dependency with
`mix deps.compile dynamo` or update it with `mix deps.update dynamo`
but not able to understand the problem. Version details are show below that i am using,
Erlang/OTP 17 [erts-6.1]
Interactive Elixir (0.14.1)

Dynamo is using an incompatible Elixir version. Open up the mix.exs file inside the deps/dynamo checkout in your repository and see the closest version Dynamo was running against.
Also note Dynamo is no in active development, you will likely have better luck with Phoenix.

Related

make on ChicagoBoss failing with escript: exception error: undefined function rebar:main/1

I am trying to install ChicagoBoss based on the instructions here. Now, Make is failing with exception -
=ERROR REPORT==== 14-Dec-2022::11:15:33.605319 ===
beam/beam_load.c(148): Error loading module rebar:
please re-compile this module with an Erlang/OTP 25 compiler
escript: exception error: undefined function rebar:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
make: *** [compile] Error 127
I have further installed rebar3 using command -
homebrew install rebar3
I am running Erlang OTP/25 in mac. I haven't been able to understand if it's a problem with
rebar3
or
ChicagoBoss
The problem is with ChicagoBoss. It includes a rebar binary that was compiled with Erlang/OTP release 17, but Erlang/OTP release 25 can only use modules compiled with release 21 or later.
The rebar binary starts with the line #!/usr/bin/env escript, meaning that it looks for escript in the PATH. This picks up release 25, causing this problem. You could try installing release 24 or earlier to work around this.
You might find ASDF useful for switching between Erlang versions: https://github.com/asdf-vm/asdf-erlang

ParserError: Syntax Error at line: 1, column 25 - Error compiling sass only when deploying to production or running CI

I am failing to see what is the reason for the compilation error.
Also, it is worth noting that I can run my app locally. ./bin/webpack-dev-server works just fine. Running tests locally also work.
I am out of ideas, specially given I never really understood the ins and outs of webpack and all the transpilation hackery.
ERROR in ./app/javascript/src/application.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
ParserError: Syntax Error at line: 1, column 25
at /home/runner/work/my_app/my_app/app/javascript/src/application.scss:6:7298
at Parser.error (/home/runner/work/my_app/my_app/node_modules/postcss-values-parser/lib/parser.js:127:11)
at Parser.operator (/home/runner/work/my_app/my_app/node_modules/postcss-values-parser/lib/parser.js:162:20)
at Parser.parseTokens (/home/runner/work/my_app/my_app/node_modules/postcss-values-parser/lib/parser.js:245:14)
at Parser.loop (/home/runner/work/my_app/my_app/node_modules/postcss-values-parser/lib/parser.js:132:12)
at Parser.parse (/home/runner/work/my_app/my_app/node_modules/postcss-values-parser/lib/parser.js:51:17)
at parse (/home/runner/work/my_app/my_app/node_modules/postcss-custom-properties/index.cjs.js:47:30)
at /home/runner/work/my_app/my_app/node_modules/postcss-custom-properties/index.cjs.js:333:24
at /home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:194:18
at /home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:139:18
at Rule.each (/home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:105:16)
at Rule.walk (/home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:135:17)
at /home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:152:24
at Root.each (/home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:105:16)
at Root.walk (/home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:135:17)
at Root.walkDecls (/home/runner/work/my_app/my_app/node_modules/postcss/lib/container.js:192:19)
at transformProperties (/home/runner/work/my_app/my_app/node_modules/postcss-custom-properties/index.cjs.js:330:8)
at /home/runner/work/my_app/my_app/node_modules/webpack/lib/NormalModule.js:316:20
at /home/runner/work/my_app/my_app/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /home/runner/work/my_app/my_app/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/home/runner/work/my_app/my_app/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at /home/runner/work/my_app/my_app/node_modules/postcss-loader/src/index.js:208:9
# ./app/javascript/packs/application.js 5:30-62
I just fixed it. I had to comment out a few lines at a time in my sass fieles until I realized bootstrap could not compile. I updated it from version 5.0.0 to version 5.1.3 (latest at the time of this writing) and it fixed it.

Compile error cmark Erlang Phoenix on Windows

I am trying to run a Phoenix server on Windows.
On running mix deps.get the following result is given
`Running dependency resolution
* Getting cmark (Hex package)
Checking package (https://repo.hex.pm/tarballs/cmark-0.6.10.tar)
Using locally cached package`
Then when running mix ecto.create the following error is given
`C:\Users\alex\Documents\Alex Docs\Datamo\githubrepo\datamo>mix ecto.create
===> Compiling idna
==> cmark
could not compile dependency :cmark, "mix compile" failed. You can recompile
this dependency with "mix deps.compile cmark", update it with
"mix deps.update cmark" or clean it with "mix deps.clean cmark"
** (ErlangError) erlang error: :enoent
(elixir) lib/system.ex:544: System.cmd("make", [], [stderr_to_stdout: true])
mix.exs:85: Mix.Tasks.Compile.Cmark.run/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(elixir) lib/enum.ex:1184: Enum."-map/2-lists^map/1-0-"/2
(mix) lib/mix/tasks/compile.all.ex:19: anonymous fn/1 in
Mix.Tasks.Compile.All.run/1
(mix) lib/mix/tasks/compile.all.ex:37:
Mix.Tasks.Compile.All.with_logger_app/1
(mix) lib/mix/task.ex:296: Mix.Task.run_task/3
(mix) lib/mix/tasks/compile.ex:84: Mix.Tasks.Compile.run/1`
Attempting to run mix deps.compile cmark creates an error
`** (Mix) Cannot compile dependency :cmark because it isn't available, run "mix deps.get" first`
But that was already run in the first stage with the error shown above. It seems to be stuck in a loop.
Is this because it's unable to unpack the tar file on windows?

production env does not find OTP module :httpc when using exrm

I'm trying to create a release for my phoenix-framework project.
Everything is working fine, until my code need to do a specific action using :httpc module from OTP.
Apparently exrm, hasn't bundled the httpc module, and therefore could not find it.
I have tried to add it into my mix.exs application dependance, but as soon as I do, it will refuse to create a release due to an "error"
does anyone know how to fix this ?
For mix.env with :httpc as dependency :
$ MIX_ENV=prod mix release --verbosity=vebose
Building release with MIX_ENV=prod.
==> Generating relx configuration...
==> Generating sys.config...
==> Generating boot script...
==> Packaging consolidated protocols...
==> Generating release...
===> Starting relx build process ...
===> Resolving OTP Applications from directories:
/home/morgan/Documents/rateapi/_build/prod/lib
/home/morgan/Documents/rateapi/deps
/usr/local/lib/elixir/bin/../lib/eex/ebin
/usr/local/lib/elixir/bin/../lib/elixir/ebin
/usr/local/lib/elixir/bin/../lib/ex_unit/ebin
/usr/local/lib/elixir/bin/../lib/iex/ebin
/usr/local/lib/elixir/bin/../lib/logger/ebin
/usr/local/lib/elixir/bin/../lib/mix/ebin
/home/morgan/Documents/rateapi/lib
/usr/erlang/otp_R18B03/lib/erlang/lib
/home/morgan/Documents/rateapi/rel
==> ERROR: "Failed to build release. Please fix any errors and try again."
For mix.env without :httpc dependency :
** (exit) an exception was raised:
** (UndefinedFunctionError) function :httpc.request/4 is undefined (module :httpc is not available)
:httpc.request(:get, {'http://free.currencyconverterapi.com/api/v3/currencies', []}, [], [])
(fx_rates) web/controllers/rate_controller.ex:46: FxRates.V1.RateController.reload_currencies/0
(fx_rates) web/controllers/rate_controller.ex:66: FxRates.V1.RateController.show/2
(fx_rates) web/controllers/rate_controller.ex:1: FxRates.V1.RateController.action/2
(fx_rates) web/controllers/rate_controller.ex:1: FxRates.V1.RateController.phoenix_controller_pipeline/2
(fx_rates) lib/phoenix/router.ex:261: FxRates.Router.dispatch/2
(fx_rates) web/router.ex:1: FxRates.Router.do_call/2
(fx_rates) lib/fx_rates/endpoint.ex:1: FxRates.Endpoint.phoenix_pipeline/1
You may be missing the erlang-inets package. Try to install it or reinstall it again. If you are using Ubuntu you may install it with:
sudo apt-get install erlang-inets
Alternatively you may want to try adding the module :inets to your mix.exs application dependencies.

Configuring Lager - I get this error: undefined parse transform 'lager_transform'

I'm testing this https://github.com/saleyn/erws_example on R16B03 (both on windows & Ubuntu)
==> erws_example (compile)
src/erws_handler.erl:none: undefined parse transform 'lager_transform'
ERROR: compile failed while processing /home/charles/erws_example: rebar_abort
I've seen this suggestion http://philipcristiano.com/2013/05/27/ordering-of-rebar-dependencies.html
So far, i'm unable to get any headway.
Thanks.
It seems rebar can not compile parse transforms before compiling everything else (https://github.com/basho/rebar/issues/270). The solution is to compile module with parse transform manually or use file-level parse_transform compiler directive instead of project level.
Try to put lager to first position in rebar dependency list. it will fix it. rebar ordering compile dependencies according to this list, not dependency tree))

Resources