erlef / rebar3_hex

Rebar3 Hex library
Apache License 2.0
101 stars 49 forks source link

Error on `hex info katana` #29

Closed waisbrot closed 8 years ago

waisbrot commented 8 years ago

I'm trying to compile Inaka/elvis_core@efa6df5 using rebar 3.0.0-beta.4+build.155.ref350fcd9 on Erlang/OTP 18 Erts 7.2.1

It's got a reference to {katana, "0.2.20"} which rebar3 is failing to find, even though it appears to exist (https://hex.pm/packages/katana).

I tried to run rebar3 hex info katana to see what's going on, and I see the following error:

$ DEBUG=1 rebar3 hex info katana                                                         
===> Load global config file /Users/waisbrot/.config/rebar3/rebar.config
===> Not adding provider hex user from module rebar3_hex_user because it already exists from module rebar3_hex_user
===> Not adding provider hex cut from module rebar3_hex_cut because it already exists from module rebar3_hex_cut
===> Not adding provider hex config from module rebar3_hex_config because it already exists from module rebar3_hex_config
===> Not adding provider hex key from module rebar3_hex_key because it already exists from module rebar3_hex_key
===> Not adding provider hex info from module rebar3_hex_info because it already exists from module rebar3_hex_info
===> Not adding provider hex owner from module rebar3_hex_owner because it already exists from module rebar3_hex_owner
===> Not adding provider hex docs from module rebar3_hex_docs because it already exists from module rebar3_hex_docs
===> Not adding provider hex search from module rebar3_hex_search because it already exists from module rebar3_hex_search
===> Not adding provider hex publish from module rebar3_hex_pkg because it already exists from module rebar3_hex_pkg
===> Expanded command sequence to be run: []
===> Expanded command sequence to be run: [{hex,info}]
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace
===> Uncaught error: undef
===> Stack trace to the error location: [{jsx,decode,
                                                 [<<"{\n  \"url\": \"https://hex.pm/api/packages/katana\",\n  \"updated_at\": \"2016-01-19T16:14:25Z\",\n  \"releases\": [\n    {\n      \"version\": \"0.2.20\",\n      \"url\": \"https://hex.pm/api/packages/katana/releases/0.2.20\",\n      \"updated_at\": \"2016-01-19T16:14:25Z\",\n      \"inserted_at\": \"2016-01-19T16:14:25Z\"\n    },\n    {\n      \"version\": \"0.2.19\",\n      \"url\": \"https://hex.pm/api/packages/katana/releases/0.2.19\",\n      \"updated_at\": \"2016-01-12T11:00:06Z\",\n      \"inserted_at\": \"2016-01-12T11:00:06Z\"\n    },\n    {\n      \"version\": \"0.2.18\",\n      \"url\": \"https://hex.pm/api/packages/katana/releases/0.2.18\",\n      \"updated_at\": \"2015-12-31T15:40:21Z\",\n      \"inserted_at\": \"2015-12-31T15:40:21Z\"\n    },\n    {\n      \"version\": \"0.2.17\",\n      \"url\": \"https://hex.pm/api/packages/katana/releases/0.2.17\",\n      \"updated_at\": \"2015-12-30T21:03:26Z\",\n      \"inserted_at\": \"2015-12-30T21:03:26Z\"\n    }\n  ],\n  \"name\": \"katana\",\n  \"meta\": {\n    \"maintainers\": [\n      \"unbalancedparentheses\",\n      \"Inaka\"\n    ],\n    \"links\": {\n      \"Github\": \"https://github.com/inaka/erlang-katana\"\n    },\n    \"licenses\": [\n      \"Apache 2.0\"\n    ],\n    \"description\": \"Erlang grab bag of useful functions. It should have been called swiss army knife but katanas are deadlier\"\n  },\n  \"inserted_at\": \"2015-12-30T21:03:26Z\",\n  \"downloads\": {\n    \"week\": 106,\n    \"day\": 21,\n    \"all\": 191\n  }\n}">>],
                                                 []},
                                                {rebar3_hex_http,get,2,
                                                 [{file,
                                                   "/Users/waisbrot/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_http.erl"},
                                                  {line,23}]},
                                                {rebar3_hex_info,package,1,
                                                 [{file,
                                                   "/Users/waisbrot/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_info.erl"},
                                                  {line,54}]},
                                                {rebar3_hex_info,do,1,
                                                 [{file,
                                                   "/Users/waisbrot/.cache/rebar3/plugins/rebar3_hex/src/rebar3_hex_info.erl"},
                                                  {line,40}]},
                                                {rebar_core,do,2,
                                                 [{file,
                                                   "/home/travis/build/rebar/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
                                                  {line,125}]},
                                                {rebar_prv_do,do_tasks,2,
                                                 [{file,
                                                   "/home/travis/build/rebar/rebar3/_build/default/lib/rebar/src/rebar_prv_do.erl"},
                                                  {line,68}]},
                                                {rebar_core,do,2,
                                                 [{file,
                                                   "/home/travis/build/rebar/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
                                                  {line,125}]},
                                                {rebar3,main,1,
                                                 [{file,
                                                   "/home/travis/build/rebar/rebar3/_build/default/lib/rebar/src/rebar3.erl"},
                                                  {line,56}]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

I'd be happy to work on a PR, but I wasn't able to figure out how rebar3_hex_http.erl:23 leads to a call to jsx:decode/1

rebar3 report (I can submit a ticket over there if that's better) says

$ rebar3 report hex info katana                                                      
Rebar3 report
 version 3.0.0-beta.4+build.155.ref350fcd9
 generated at 2016-01-20T19:50:01+00:00
=================
Please submit this along with your issue at https://github.com/rebar/rebar3/issues (and feel free to edit out private information, if any)
-----------------
Task: hexinfokatana
Entered as:
  hexinfokatana
-----------------
Operating System: x86_64-apple-darwin15.2.0
ERTS: Erlang/OTP 18 [erts-7.2.1] [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Root Directory: /usr/local/Cellar/erlang/18.2.1/lib/erlang
Library directory: /usr/local/Cellar/erlang/18.2.1/lib/erlang/lib
-----------------
Loaded Applications:
bbmustache: 1.0.4
certifi: 0.3.0
cf: 0.2.1
common_test: 1.11.1
compiler: 6.0.2
crypto: 3.6.2
cth_readable: 1.2.0
dialyzer: 2.8.2
edoc: 0.7.17
erlware_commons: 0.18.0
eunit: 2.2.12
eunit_formatters: 0.3.1
getopt: 0.8.2
inets: 6.1
kernel: 4.1.1
providers: 1.6.0
public_key: 1.1
relx: 3.13.0
sasl: 2.6.1
snmp: 5.2.1
ssl_verify_hostname: 1.0.5
stdlib: 2.7
syntax_tools: 1.7
tools: 2.8.2

-----------------
Escript path: undefined
Providers:
  app_discovery as auto clean compile compile config cover ct cut deps dialyzer do docs edoc escriptize eunit help info install install_deps key list lock new owner path pkgs publish release relup report search shell tar tree unlock update upgrade upgrade upgrade user version xref
tsloughter commented 8 years ago

You appear to be running an old copy of the plugin. json is no longer used. Did you install it globally? If so, upgrade with rebar3 as global plugins upgrade rebar3_hex or if not global just rebar3 plugins upgrade rebar3_hex

tsloughter commented 8 years ago

Oh, but rebar3 will not find katana for installation because it is only erlang.mk compatible.

waisbrot commented 8 years ago

I had rebar3_hex installed both locally and globally and I was updating the local version but getting the global version.

I hadn't realized that erlang.mk deps couldn't be used by rebar3. Thanks!