35

Building websockets app based off of actioncable-examples. When starting server, running rake, etc. I keep getting the message:

Array values in the parameter to `Gem.paths=` are deprecated.

Haven't seen a solution here, but did find one. I wanted to post the question and answer here so that it's available.

E-Riz
  • 31,431
  • 9
  • 97
  • 134
Richard_G
  • 4,700
  • 3
  • 42
  • 78

3 Answers3

96

I found the answer in RubyGems issue #1551 here. The binstubs, the files in the bin folder, need to be updated. The best way to do this is:

bundle update spring
bundle exec spring binstub --remove --all
bundle exec spring binstub --all

And that resolved the problem for me.

Richard_G
  • 4,700
  • 3
  • 42
  • 78
0

I also face same error in my rails 4.2.7 application and I fixed the error to update bin/spring file line no 11

Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) }
Shajed
  • 647
  • 10
  • 14
  • 1
    This answer is useful because it points down to the root cause of the issue. However, the accepted answer above gives instructions to regenerate that same binstub file, which should be safer because there is no risk of putting the wrong code in by hand. – David Bodow Aug 01 '20 at 00:58
-1

tl;dr bin/spring binstub, you might need to update spring before that (if 1.3.3 <= spring < 1.6.4).

spring had been using an array for the GEM_PATH value in its binstubs since 1.3.3 till 1.6.4.

In rubygems-2.6.0 they were planning to give up on arrays, but apparently those binstubs made its way in a lot of projects. So they restored the array handling in rubygems-2.6.1, but with a deprecation warning. Those 2 correspond to Ruby 2.4.0.

x-yuri
  • 16,722
  • 15
  • 114
  • 161