Elixir使用Crawly爬虫框架时:epipe依赖编译失败如何解决?
Elixir使用Crawly框架出现epipe依赖编译失败的解决方案
我按照Crawly官方教程尝试开发爬虫,首先在mix.exs文件中添加所需依赖:
defp deps do [ {:crawly, "~> 0.13.0"}, {:floki, "~> 0.26.0"} ] end
执行mix deps.get拉取依赖后,新增如下爬虫代码:
defmodule Homebase do use Crawly.Spider @impl Crawly.Spider def base_url(), do: "https://www.homebase.co.uk" @impl Crawly.Spider def init() do [ start_urls: [ "https://www.homebase.co.uk/our-range/tools" ] ] end @impl Crawly.Spider def parse_item(_response) do %Crawly.ParsedItem{:items => [], :requests => []} end end
运行iex -S mix时出现如下报错:
** (Mix) Could not compile dependency :epipe, "/home/niki/.mix/rebar3 bare compile --paths /home/niki/projects/first-crawler/crawler2/spiderman/_build/dev/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile epipe", update it with "mix deps.update epipe" or clean it with "mix deps.clean epipe"
尝试错误提示给出的重新编译、更新、清理依赖的方案均未生效,执行mix deps.compile的输出如下:
最终解决方案
该问题由Elixir版本与Crawly 0.13.0版本不兼容导致,安装kiex并将Elixir版本切换到1.10后,问题得到解决。
内容的提问来源于stack exchange,提问作者Nikolay Patarov
相关产品推荐
相关产品推荐

