Esy: Linux: esy fails to fetch dependencies when `shasum` is not available

Created on 10 Feb 2019  路  4Comments  路  Source: esy/esy


esy version: 0.5.6
Operating System: Fedora 29 kernel: 4.20.3-200.fc29.x86_64

Issue:
Linux: esy fails to fetch dependencies when shasum isn't available.

Package.json

https://github.com/esy-ocaml/hello-reason/blob/master/package.json

Actual behavior:

After cloning the example repo and running esy, I receive:

error unable to fetch @esy-ocaml/[email protected]:         
                                                source: archive:https://registry.npmjs.org/@esy-ocaml/substs/-/substs-0.0.1.tgz#sha1:59ebdbbaedcda123fc7ed8fb2b302b7d819e9a46
                                                error: error: run ['shasum' '--algorithm' '1'
                                                            '/home/miguelb/Work/ocaml/hello-reason/_esy/default/tmp/esy-75cd58/archive']: exited with 127
                                                         fetching dist: archive:https://registry.npmjs.org/@esy-ocaml/substs/-/substs-0.0.1.tgz#sha1:59ebdbbaedcda123fc7ed8fb2b302b7d819e9a46
error: installation error              
  fetching @esy-ocaml/[email protected]
esy: exiting due to errors above

Expected behavior:
esy to install and fetch dependencies.

Additional steps to reproduce:

  • install esy@latest fresh: npm i -g esy@latest
  • clone https://github.com/esy-ocaml/hello-reason.git
  • run esy

Most helpful comment

Mentioned this on the discord chat and it was suggested to check if I had shasum on the system. I didn't, and that's what was causing the install to fail.

Fedora 29 has a bunch of sha*sum commands but no shasum. The fix was to install perl-Digest-SHA.

All 4 comments

Mentioned this on the discord chat and it was suggested to check if I had shasum on the system. I didn't, and that's what was causing the install to fail.

Fedora 29 has a bunch of sha*sum commands but no shasum. The fix was to install perl-Digest-SHA.

@miguelbermudez I think we can close this issue, and keep track of all the dependencies in #441. shasum has been added there.

I faced the same issue on arch linux.
My solution:
With the core/perl package there comes a /usr/bin/core_perl/shasum.
Put this executable into the path and esy install should work.

Regarding the shasum issue, this was my quick and dirty hack on Fedora 32. I named this file shasum and put it in somewhere in my $PATH:

#!/bin/env ruby

require 'optparse'

options = {}
OptionParser.new do |opts|
  opts.on("-a", "--algorithm=") do |a|
    options[:algorithm] = a
  end
end.parse!

if(File.exist?(ARGV.last))
  if options[:algorithm] == "1"
    system("sha1sum #{ARGV.last}")
  elsif options[:algorithm] == "256"
    system("sha256sum #{ARGV.last}")
  end
end
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ulrikstrid picture ulrikstrid  路  5Comments

zartstrom picture zartstrom  路  3Comments

jordwalke picture jordwalke  路  4Comments

lessp picture lessp  路  7Comments

smorimoto picture smorimoto  路  3Comments