My CI (Drone) show me the error Shrine::Error: The 'file' command-line tool is not installed, I have researched about this and find some responses for this, I know where this is verified, but my linux says that exists the file command:
file is already the newest version.
file set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded
What I can do for fix it? Any idea? Thanks.
Fixed, sorry. Only need add gem 'mime-types', '~> 3.1'. Thanks.
Just to follow-up on this. The reason why CI raised the error was because Shrine's determine_mime_type plugin by default uses the file utility, and it apparently wasn't installed on the CI, because executing the command returned a 127 exit status (or Errno::ENOENT when using Open3).
You can either figure out how to install the file utility, or use a different :analyzer on the CI. Adding gem 'mime-types', '~> 3.1' alone won't fix the problem, because Shrine will still attempt to use the :file analyzer; you also have to change the analyzer.
plugin :determine_mime_type, analyzer: :mime_types
For those using Docker's Alpine image, just be sure to install the linux file utility. That solved the issue for our CI build process without messing with application code.
Most helpful comment
Just to follow-up on this. The reason why CI raised the error was because Shrine's
determine_mime_typeplugin by default uses thefileutility, and it apparently wasn't installed on the CI, because executing the command returned a 127 exit status (orErrno::ENOENTwhen usingOpen3).You can either figure out how to install the
fileutility, or use a different:analyzeron the CI. Addinggem 'mime-types', '~> 3.1'alone won't fix the problem, because Shrine will still attempt to use the:fileanalyzer; you also have to change the analyzer.