# Discourse non trova le gemme specificata nel plugin

**URL:** https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968
**Category:** Development
**Created:** [3 Marzo 2022, 3:21pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968 "2022-03-03T15:21:29Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 3:21pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/1 "2022-03-03T15:21:29Z")

</div>

Ciao! Sto sviluppando un [plugin](https://github.com/spruceid/discourse-siwe-auth) per abilitare Sign-In with Ethereum su Discourse. Il problema è che quando installo il plugin ricevo un errore con una delle dipendenze (rbsecp256k1).

```bash
ERROR: Error installing rbsecp256k1:
	ERROR: Failed to build gem native extension.

    current directory: /var/www/discourse/plugins/sdp/gems/2.7.5/gems/rbsecp256k1-5.1.0/ext/rbsecp256k1
/usr/local/bin/ruby -I /usr/local/lib/ruby/site_ruby/2.7.0 -r ./siteconf20220303-1234-gyqjb.rb extconf.rb
extconf.rb:3:in `require': cannot load such file -- mini_portile2 (LoadError)
	from extconf.rb:3:in `<main>'

extconf failed, exit code 1

```

Mi chiedo cosa possa succedere dato che funziona in sviluppo se installo manualmente le dipendenze.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3 Marzo 2022, 3:31pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/2 "2022-03-03T15:31:59Z")

</div>

Quella gemma ha dipendenze a livello di sistema operativo che devi avere installate, secondo la loro documentazione: [GitHub - etscrivner/rbsecp256k1: Compiled Ruby wrapper around libsecp256k1 for secp256k1 ECDSA.](https://github.com/etscrivner/rbsecp256k1#linux)

---

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 3:34pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/3 "2022-03-03T15:34:35Z")

</div>

Sì, li ho già installati il problema si verifica quando non riesce a trovare `mini_portile2`, che è una delle sue dipendenze.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3 Marzo 2022, 3:36pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/4 "2022-03-03T15:36:43Z")

</div>

Come hai dichiarato la dipendenza `mini_portile2` sul tuo plugin?

---

<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: [3 Marzo 2022, 3:51pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/5 "2022-03-03T15:51:01Z")

</div>

Ho riscontrato lo stesso problema durante l’installazione della stessa dipendenza gem.

Dai un’occhiata

> [@Having a hard time installing \`eth\` gem in a plugin in production](https://meta.discourse.org/t/having-a-hard-time-installing-eth-gem-in-a-plugin-in-production/217496?u=fzngagan):
>
> I’m having to install the eth gem in a plugin but really having a hard time doing that. It depends on a bunch of other gems, a few of which have native extensions. Here’s the dependency list if you wanna give it a try. gem 'pkg-config', '1.4.7', require: false gem 'mkmfmf', '0.4', require: false gem 'keccak', '1.3.0', require: false gem 'zip', '2.0.2', require: false gem 'mini\_portile2', '2.7.0', require: false gem 'rbsecp256k1', '5.1.0', require: false gem 'konstructor', '1.0.2', require: fals…

Mi piacerebbe molto se ci fosse una soluzione più diretta.

---

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 3:54pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/6 "2022-03-03T15:54:17Z")

</div>

> <https://github.com/spruceid/discourse-siwe-auth/blob/main/plugin.rb#L19>

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3 Marzo 2022, 4:47pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/7 "2022-03-03T16:47:01Z")

</div>

> [@w4ll3](#):
>
> `gem 'mini_portile2', '2.7.0', require: false`

Non puoi semplicemente eliminarlo dato che è già nel core di Discourse?

> <https://github.com/discourse/discourse/blob/main/Gemfile.lock#L234>

---

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 5:03pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/8 "2022-03-03T17:03:01Z")

</div>

Voglio dire, posso ma il problema non è con quella gemma, il problema è con `rbsecp256k1`, quando prova a compilarlo non trova la gemma `mini_portile2` (come dice l’errore: `cannot load such file -- mini_portile2 (LoadError) from extconf.rb:3:in \u003cmain\u003e'`)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [3 Marzo 2022, 5:25pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/9 "2022-03-03T17:25:48Z")

</div>

Stai ripercorrendo lo stesso terreno di @fzngagan, vedi il suo link sopra: [Having a hard time installing `eth` gem in a plugin in production - #3 by fzngagan](https://meta.discourse.org/t/having-a-hard-time-installing-eth-gem-in-a-plugin-in-production/217496/3?u=merefield), forse puoi contribuire alla sua soluzione.

---

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 5:29pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/10 "2022-03-03T17:29:32Z")

</div>

La sua soluzione funziona, ma non la considero un’opzione valida, nessun utente sarebbe disposto a fare tutto ciò solo per aggiungere un plugin. Volevo solo sapere se qualcuno poteva pensare a un approccio migliore (il più vicino possibile a semplicemente aggiungere il repository e il gioco è fatto). come ha detto lui stesso @fzngagan:

> Mi piacerebbe molto se ci fosse una soluzione più diretta.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [3 Marzo 2022, 5:36pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/11 "2022-03-03T17:36:34Z")

</div>

E ora abbiamo due argomenti sullo stesso identico problema…

---

<div class="post-metadata">

### Author: ![w4ll3](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/w4ll3/32/251894_2.png) [@w4ll3](https://meta.discourse.org/u/w4ll3)
#### Post date: [3 Marzo 2022, 9:56pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/12 "2022-03-03T21:56:07Z")

</div>

Sto restringendo il campo, non sembra essere correlato alle gemme, sembra essere correlato a `extconf.rb`. Ho provato con altre poche gemme con una configurazione più complessa (`ruby-magic` e `libusb`), entrambe non funzionano (per motivi diversi) hanno tutte in comune dipendenze in `extconf.rb`.

---

<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: [14 Marzo 2022, 7:43am UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/13 "2022-03-14T07:43:58Z")

</div>

Questo problema è stato risolto negli ultimi branch `tests-passed` e `stable` di discourse.

> <https://github.com/discourse/discourse/commit/6b8c622762571a9012cb1805f04b6b2593526021>
>
> when bundler is loaded, it sets the \`RUBYOPT\` environment variable to setup bund…ler. However, it was causing weird errors like the following when we try to install
> custom plugin gems into a specific directory.
> 
> \`\`\`
> /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:214:in \`rescue in load\_spec\_files': https://github.com/discourse/mail.git is not yet checked out. Run \`bundle install\` first. (Bundler::GitError)
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:210:in \`load\_spec\_files'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/path.rb:107:in \`local\_specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:178:in \`specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/lazy\_specification.rb:88:in \`\_\_materialize\_\_'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:75:in \`block in materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:72:in \`map!'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:72:in \`materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:468:in \`materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:190:in \`specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:238:in \`specs\_for'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/runtime.rb:18:in \`setup'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler.rb:151:in \`setup'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/setup.rb:20:in \`block in \<top (required)\>'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/ui/shell.rb:136:in \`with\_level'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/ui/shell.rb:88:in \`silence'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/setup.rb:20:in \`\<top (required)\>'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/site\_ruby/2.7.0/rubygems/core\_ext/kernel\_require.rb:85:in \`require'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/site\_ruby/2.7.0/rubygems/core\_ext/kernel\_require.rb:85:in \`require'
> \`\`\`

> <https://github.com/discourse/discourse/pull/16176>
>
> when bundler is loaded, it sets the \`RUBYOPT\` environment variable to setup bund…ler. However, it was causing weird errors like the following when we try to install
> custom plugin gems into a specific directory.
> 
> \`\`\`
> /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:214:in \`rescue in load\_spec\_files': https://github.com/discourse/mail.git is not yet checked out. Run \`bundle install\` first. (Bundler::GitError)
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:210:in \`load\_spec\_files'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/path.rb:107:in \`local\_specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/source/git.rb:178:in \`specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/lazy\_specification.rb:88:in \`\_\_materialize\_\_'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:75:in \`block in materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:72:in \`map!'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/spec\_set.rb:72:in \`materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:468:in \`materialize'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:190:in \`specs'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/definition.rb:238:in \`specs\_for'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/runtime.rb:18:in \`setup'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler.rb:151:in \`setup'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/setup.rb:20:in \`block in \<top (required)\>'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/ui/shell.rb:136:in \`with\_level'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/ui/shell.rb:88:in \`silence'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/gems/2.7.0/gems/bundler-2.3.5/lib/bundler/setup.rb:20:in \`\<top (required)\>'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/site\_ruby/2.7.0/rubygems/core\_ext/kernel\_require.rb:85:in \`require'
> from /home/tgxworld/.asdf/installs/ruby/2.7.5/lib/ruby/site\_ruby/2.7.0/rubygems/core\_ext/kernel\_require.rb:85:in \`require'
> \`\`\`

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [14 Marzo 2022, 5:39pm UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/14 "2022-03-14T17:39:02Z")

</div>

> [@fzngagan](#):
>
> `stable`

Non ancora, la PR non è stata ancora unita.

---

<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: [18 Marzo 2022, 6:09am UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/18 "2022-03-18T06:09:55Z")

</div>

@RGJ Ci sono stati alcuni test falliti che dovevano essere affrontati prima. Ora è unito.

---

<div class="post-metadata">

### Author: ![tgxworld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tgxworld/32/106117_2.png) [@tgxworld](https://meta.discourse.org/u/tgxworld)
#### Post date: [20 Marzo 2022, 2:50am UTC](https://meta.discourse.org/t/discourse-cant-find-gems-specified-in-the-plugin/219968/20 "2022-03-20T02:50:46Z")

</div>


