Could not open library 'libcurl'

When using the Typhhoeus gem, I’m getting the following exception:

Could not open library 'libcurl': libcurl: cannot open shared object file: No such file or directory. (LoadError)
Could not open library 'libcurl.so': libcurl.so: cannot open shared object file: No such file or directory.
Could not open library 'libcurl.so.4': libcurl.so.4: cannot open shared object file: No such file or directory

Came across an apparently working fix but it’s for windows machines.

Any ideas?

1 Like

Add curl via Nix. In shell:

sed -i 's/];/  pkgs.curl.dev\n  &/' replit.nix

If it is still erroring after what @UMARismyname said, try adding the nix path to libcurl to LD_LIBRARY_PATH

How do I do that? Adding curl didn’t help.

First, replace pkgs.curl.dev with pkgs.curl.out in replit.nix. Then, in the same file, right after deps = [];add this:

env = {
    LD_LIBRARY_PATH = "${pkgs.curl.out}/lib:$LD_LIBRARY_PATH";
};
2 Likes

Thanks, that worked!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.