Shrine: Shrine error with CI build

Created on 16 Nov 2016  路  3Comments  路  Source: shrinerb/shrine

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.

Most helpful comment

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

All 3 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

printercu picture printercu  路  10Comments

pmackay picture pmackay  路  4Comments

thebravoman picture thebravoman  路  8Comments

janko picture janko  路  8Comments

nynhex picture nynhex  路  6Comments