# Specifying the gem dependecies for plugin - gem does not exist

**URL:** <https://meta.discourse.org/t/specifying-the-gem-dependecies-for-plugin-gem-does-not-exist/65878>\
**Category:** Development\
**Created:** [9 ביולי,‏ 2017,‏ 4:07am UTC](https://meta.discourse.org/t/specifying-the-gem-dependecies-for-plugin-gem-does-not-exist/65878 "2017-07-09T04:07:20Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![net\_deamon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/net_deamon/32/70126_2.png) [@net\_deamon](https://meta.discourse.org/u/net_deamon)\
**Post date:** [9 ביולי,‏ 2017,‏ 4:07am UTC](https://meta.discourse.org/t/specifying-the-gem-dependecies-for-plugin-gem-does-not-exist/65878/1 "2017-07-09T04:07:20Z")

</div>

I did go through the suggesstions in following posts

> [@Plugin using own gem](https://meta.discourse.org/t/plugin-using-own-gem/50007/6):
>
> Gems declared in a plugin are installed and loaded differently as per our implementation: In order to get it to work, you’ll have to specify all the gem’s dependencies which are not already included in the Gemfile.

> [@Newrelic plugin](https://meta.discourse.org/t/newrelic-plugin/12986):
>
> New Relic support Author: Sam Saffron Support for [http://newrelic.com](http://newrelic.com) plugins/newrelic/plugin.rb # name: enable New Relic rpm # about: New Relic support # version: 0.1 # authors: Sam Saffron ENV["NRCONFIG"] = File.expand\_path('../newrelic.yml', \_\_FILE\_\_) gem "newrelic\_rpm", "3.6.7.152" NewRelic::Control.instance.init\_plugin :config =\> Rails.configuration after\_initialize do ForumsController.newrelic\_ignore :only =\> [:status] end plugins/newrelic/newrelic.yml The file you got from newrel…

So I tried 2 ways

### Specifying in plugin.rb file

* * *

My plugin depends upon “mini\_magick” for image resizing, so I specified it in plugin.rb

> gem ‘mini\_magick’, ‘~\> 4.8’

But I get the following error

> I, [2017-07-09T03:54:49.899941 #13] INFO – : \> cd /var/www/discourse && sudo -E -u discourse bundle exec rake db:migrate  
> ERROR: While executing gem … (Gem::Requirement::BadRequirementError)  
> Illformed requirement [“/root”]  
> I, [2017-07-09T03:54:54.692893 #13] INFO – : `/root` is not writable.  
> Bundler will use `/tmp/bundler/home/discourse’ as your home directory temporarily.  
> gem install mini\_magick -v ~\> 4.8 -i /var/www/discourse/plugins/discussbook-plugin/gems/2.4.1 --no-document --ignore-dependencies  
> You are specifying the gem mini\_magick in /var/www/discourse/plugins/discussbook-plugin/plugin.rb, however it does not exist!

### Specifying in yml file

* * *

As it was not working, I tried to add the gem install command in yml file custom commands

> - exec: gem install mini\_magick -v 4.8.0

I get the following log(success) when it was being rebuilt

> I, [2017-07-08T18:50:43.302333 #13] INFO – : Beginning of custom commands  
> I, [2017-07-08T18:50:43.302751 #13] INFO – : \> gem install mini\_magick -v 4.8.0  
> I, [2017-07-08T18:50:44.034391 #13] INFO – : Successfully installed mini\_magick-4.8.0  
> 1 gem installed

But when I try to require it in the route, I got the following error in error log

> NameError (uninitialized constant) DiscussBook::DiscussbookController::MiniMagick)

Both of these trials did not work, can you please help me regarding what might be the error?

---

_[View the full topic](https://meta.discourse.org/t/specifying-the-gem-dependecies-for-plugin-gem-does-not-exist/65878)._
