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?
Related
I've encountered an issue trying to use bazel as a build tool for remix. I've been able to run remix in dev mode but currently unable to get remix build to work.
I've encountered a few errors that led up to this point. I'll list the errors in the order which they occurred with my fixes (just incase any of the fixes introduces a new issue)
First error in the bazel sandbox is related to a transitive dependency of #remix-run/dev (#remix-run/dev->gunzip-maybe->browserify-zlib). Bazel failed to fetch the bazel repository #npm__browserify-zlib__0.1.4. I assumed this was a bazel issue and tried to override browserify-zlib#0.1.4 with browserify-zlib#0.2.0, which worked. Here is bazel error for reference:
ERROR: /Users/emmanuel/projects/bbbazel/WORKSPACE:89:17: fetching _npm_import rule //external:npm__browserify-zlib__0.1.4: Traceback (most recent call last):
File "/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/external/aspect_rules_js/npm/private/npm_import.bzl", line 471, column 27, in _impl
pkg_json = json.decode(rctx.read(pkg_json_path))
Error in decode: at offset 685, object has duplicate key: "main"
ERROR: /private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/external/npm/BUILD.bazel:3012:6: #npm//:npm__browserify-zlib__0.1.4_source_directory depends on #npm__browserify-zlib__0.1.4//:source_directory in repository #npm__browserify-zlib__0.1.4 which failed to fetch. no such package '#npm__browserify-zlib__0.1.4//': at offset 685, object has duplicate key: "main"
Next error in the bazel sandbox is related to another transitive dependency of #remix-run/dev (#remix-run/dev->xdm->deasync). The install lifecycle hook for the deasync npm package makes a call to the node-gyp binary which doesn't exist in the sandbox and the bazel build command fails during setup. To fix this, I disabled the install lifecycle hook (I also disabled it with a pnpm install outside the sandbox and the remix build command executed perfectly) which led to the final error. Here's the error message for this error:
/Users/emmanuel/projects/bbbazel/BUILD.bazel:5:22: Running lifecycle hooks on npm package deasync#0.1.28 failed: (Exit 1): lifecycle-hooks.sh failed: error executing command (from target //:.aspect_rules_js/node_modules/deasync#0.1.28/lc) bazel-out/darwin_arm64-opt-exec-2B5CBBC6/bin/external/aspect_rules_js/npm/private/lifecycle/lifecycle-hooks.sh deasync ../../../external/npm__deasync__0.1.28/package ... (remaining 1 argument skipped)
/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/node-gyp-bin/node-gyp: line 5: 1211: command not found
node-gyp not found! Please upgrade your install of npm! You need at least 1.1.5 (I think) and preferably 1.1.30.
> deasync#0.1.28 install /private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/deasync#0.1.28/node_modules/deasync
> node ./build.js
===============================================================
Failure while running lifecycle hook for package 'deasync#0.1.28':
Script: 'install'
Command: `node ./build.js`
Stack trace:
spawn ENOENT
at ChildProcess.<anonymous> (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/external/aspect_rules_js/npm/private/lifecycle/min/index.min.js:1:91930)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1100:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
The final error suggests a bug with remix, but since it only occurs in the bazel sandbox I think it may be an issue that cuts across bazel and remix. The error returned is shown below:
The following error is a bug in Remix; please open an issue! https://github.com/remix-run/remix/issues/new
Missing output for entry point
Error
at Object.onCompileFailure (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/commands.js:180:13)
at Object.compile (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/compiler/remixCompiler.js:34:134)
at async Object.build (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/compiler/build.js:33:3)
at async Object.build (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/commands.js:175:3)
at async Object.run (/private/var/tmp/_bazel_emmanuel/f416ba8913b741927ac435783e3163e0/sandbox/darwin-sandbox/1566/execroot/fleet/bazel-out/darwin_arm64-fastbuild/bin/node_modules/.aspect_rules_js/#remix-run+dev#1.12.0_#remix-run+serve#1.12.0/node_modules/#remix-run/dev/dist/cli/run.js:449:7)
Building Remix app in production mode...
Target //examples/remix:build failed to build
I've tried to run it outside bazel and with pnpm (I added the override to the package.json for browserify-zlip#0.2.0, then I ran pnpm instal with --ignore-scripts flag) and it builds fine.
I'm not sure if this is a bug with remix or a bazel issue. Has anyone else experienced this? Or does anyone having a working version of remix with bazel as the build tool?
I've created a minified version of the repository in the state of the 3rd error https://github.com/noelenwenede/bbbazel. Start up instructions are in the readme file.
I'd like to use bazel in a locked-down environment, one without uncontrolled internet access. I'd like to force bazel to use the locally installed java, instead of downloading one. I could not figure out the required combination of flags - this is what I tried:
$ java -version
java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)
$ javac -version
javac 1.8.0_171
$ bazel clean --expunge
$ bazel info release
release 0.24.1
$ bazel build //hello
# This builds a 'hello world' cpp file.
# This rule also downloads some rules, would be nice to avoid it as
INFO: Build completed successfully, 6 total actions well
$ bazel test --nofetch //hello:hello_test
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.160s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
FAILED: Build did NOT complete successfully (3 packages loaded, 27 targets configured)
I get the same results with a more intricate command line:
$ bazel test --nofetch --define=ABSOLUTE_JAVABASE=/usr/lib/jvm/java-8-openjdk-amd64 --host_javabase=#local_jdk//:jdk --javabase=#local_jdk//:jdk --host_java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 --java_toolchain=#bazel_tools//tools/jdk:toolchain_hostjdk8 //hello:hello_test
INFO: Build options --define, --host_java_toolchain, --host_javabase, and 2 more have changed, discarding analysis cache.
ERROR: /home/erenon/.cache/bazel/_bazel_erenon/afacf41c7e3fc3f4ea7510d344b4de38/external/bazel_tools/tools/jdk/BUILD:218:1: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled. and referenced by '#bazel_tools//tools/jdk:JacocoCoverageRunner'
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: no such package '#remote_java_tools//': to fix, run
bazel fetch //...
External repository #remote_java_tools not found and fetching repositories is disabled.
INFO: Elapsed time: 0.215s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
FAILED: Build did NOT complete successfully (0 packages loaded, 50 targets configured)
I tried every combination of the java flags, no luck. I also tried to enable every incompatible change (--all_incompatible_changes), which yields to a different result:
INFO: Build options --incompatible_allow_python_version_transitions, --incompatible_auto_configure_host_platform, --incompatible_cc_coverage, and 24 more have changed, discarding analysis cache.
ERROR: While resolving toolchains for target //hello:hello_test: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
ERROR: Analysis of target '//hello:hello_test' failed; build aborted: com.google.devtools.build.lib.packages.BuildFileNotFoundException: no such package '#local_config_platform//': to fix, run
bazel fetch //...
External repository #local_config_platform not found and fetching repositories is disabled.
INFO: Elapsed time: 0.228s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
FAILED: Build did NOT complete successfully (1 packages loaded, 0 targets configured)
It now looks for #local_config_platform.
Is there a bazel target which I can build from source and includes these dependencies?
Is there a different command line, which enables bazel test --nofetch?
It appear that bootstrapping bazel from source can solve the issue. After downloading bazel-<version>-dist.zip from GitHub, in the unzipped folder:
env EXTRA_BAZEL_ARGS="--host_javabase=#local_jdk//:jdk" bash ./compile.sh
The compiled output is placed into output/bazel. This is a self-contained Bazel binary, without an embedded JDK.
https://docs.bazel.build/versions/master/install-compile-source.html
I have added poison library to rebar.config file:
{
deps, [
poison
]
}.
But when I run rebar3 compile, it shows me an error:
===> Package <<"poison">> not found. Fetching registry updates and trying again...
...
===> Package not found in registry: <<"poison">>.
How do I make it work?
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.
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.