# Facing an issue while installing some gems in the plugin

**URL:** https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780
**Category:** Development
**Created:** [August 22, 2020, 10:53pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780 "2020-08-22T22:53:43Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 22, 2020, 10:53pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/1 "2020-08-22T22:53:44Z")

</div>

@sam

I’m unable to install some gems in the plugin, for e.g. `google-protobuf`. This gem is dependency for `google-cloud-vision` gem.

Here’s a plugin trying to install it. [GitHub - fzngagan/gem-issue · GitHub](https://github.com/fzngagan/gem-issue)

> **Logs**
>
> ```plaintext
> gem install google-protobuf -v 3.13.0 -i /Users/faiz/discenv/discourse/plugins/gem-issue/gems/2.6.3 --no-document --ignore-dependencies --no-user-install
> Successfully installed google-protobuf-3.13.0-universal-darwin
> 1 gem installed
> You are specifying the gem google-protobuf in /Users/faiz/discenv/discourse/plugins/gem-issue/plugin.rb, however it does not exist!
> Looked for: /Users/faiz/discenv/discourse/plugins/gem-issue/gems/2.6.3/specifications/google-protobuf-3.13.0.gemspec
> 
> ```

The reason for this is that the `.gemspec` file’s name doesn’t match the `spec_file`’s name assumed in the code here.

> <https://github.com/discourse/discourse/blob/66976baefa52fe503c7fa2c396b15568464619ef/lib/plugin_gem.rb#L19>

IMO, this would happen probably only when using platform-specific gems as the platform name gets added to the gem name if its platform dependent. This is described here. [Specification Reference - RubyGems Guides](https://guides.rubygems.org/specification-reference/#platform=)

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [August 24, 2020, 4:58pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/2 "2020-08-24T16:58:30Z")

</div>

It’s unclear why you mentioned me on this topic? I don’t know much about our custom gem resolution, sorry.

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 24, 2020, 5:45pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/3 "2020-08-24T17:45:17Z")

</div>

I checked the blame and you have the most commits to the file I guess? Happy to be pointed in the right direction here 🙂

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [August 24, 2020, 7:58pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/4 "2020-08-24T19:58:13Z")

</div>

I think @sam might be able to help. He wrote the gem importing for plugins.

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 24, 2020, 8:14pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/5 "2020-08-24T20:14:11Z")

</div>

Sure, thanks for the lead.

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 28, 2020, 5:11am UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/6 "2020-08-28T05:11:27Z")

</div>

@sam did you get a chance to take a look?

---

<div class="post-metadata">

### Author: ![Terrapop](https://avatars.discourse-cdn.com/v4/letter/t/ecd19e/32.png) [@Terrapop](https://meta.discourse.org/u/Terrapop)
#### Post date: [August 28, 2020, 7:46am UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/7 "2020-08-28T07:46:49Z")

</div>

@sam could you help @fzngagan on this? I am sponsoring this plugin:

> [@\[PAID\] Integrate Google Cloud Vistion API into upload process](https://meta.discourse.org/t/paid-integrate-google-cloud-vistion-api-into-upload-process/161746):
>
> A plugin that checks all images uploaded to Discourse via the Google Cloud Vision API and rejects if not appropriate according to set levels. Documentation: A Ruby Gem is provided by Google: This plugin should hook into the main image upload process of Discourse for all images (posts, avatars, profile backgrounds etc.) and reject images that contain disallowed content: puts "Adult: #{safe\_search.adult}" puts "Spoof: #{safe\_search.spoof}" puts "Medical: #{safe\_search.medical…

And it will be made available for everybody. It is vital to keep a forum free of images that could potentially harm and will certainly help to not getting strikes from Google Adsense for disallowed content.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [August 28, 2020, 7:50am UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/8 "2020-08-28T07:50:20Z")

</div>

I guess it looks like there is a bug here, perhaps do a PR to try and fix this quirk?

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 28, 2020, 9:25pm UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/9 "2020-08-28T21:25:35Z")

</div>

[https://github.com/discourse/discourse/pull/10559](https://github.com/discourse/discourse/pull/10559)

Here’s a very simple PR fixing the issue.

I tried to find a fancy way to tackle this so that the devs don’t have to worry about the platform thing but didn’t find any. Happy to improve upon this if I find a better solution.

Also, a tip for devs, you can simply put the gem in discourse’s gemfile during development and not go insane. Only worry about all of this for deployment.

---

<div class="post-metadata">

### Author: ![fzngagan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fzngagan/32/259349_2.png) [@fzngagan](https://meta.discourse.org/u/fzngagan)
#### Post date: [August 31, 2020, 4:20am UTC](https://meta.discourse.org/t/facing-an-issue-while-installing-some-gems-in-the-plugin/161780/10 "2020-08-31T04:20:39Z")

</div>

Thanks for merging @sam.
