简体   繁体   中英

can't install puma gem, using with Heroku and rails

Heroku recently recommended using the puma webserver gem rather than unicorn. So, I removed the unicorn gem and installed the puma gem. It installs to the Gemfile , but not the Gemfile.lock . I have no clue what's going on. Here's the code and the steps I've taken.

Gemfile:

gem 'puma', '~> 2.11.0' - in the production group

After running bundle install , running gem list shows (among others):

psych (2.0.5)
puma (2.11.0)
pundit (0.3.0)
rack (1.6.0)

But it's not in the Gemfile.lock :

pg (0.18.1)
pry (0.10.1)
  coderay (~> 1.1.0)
  method_source (~> 0.8.1)
  slop (~> 3.4)
pundit (0.3.0)
  activesupport (>= 3.0.0)
rack (1.6.0)

Running foreman confirms that. From the command line, foreman start :

19:58:11 web.1  | started with pid 51379
19:58:12 web.1  | /Users/dougharman/.rvm/gems/ruby-2.1.5/gems/bundler-1.7.12/lib/
  bundler/rubygems_integration.rb:256:in `block in replace_gem': 
  puma is not part of the bundle. Add it to Gemfile. (Gem::LoadError)
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/puma:22:in `<main>'
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
19:58:12 web.1  |   from /Users/dougharman/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
19:58:12 web.1  | exited with code 1
19:58:12 system | sending SIGTERM to all processes
SIGTERM received

There are several SO questions dealing with similar problems running Windows. I'm on Mac OSX Mavericks, ruby 2.1.5, and rails 4.2.0. Based upon some of the SO q&a, I uninstalled rvm and ruby (including all prior versions) and reinstalled them. I am still getting the same outcome.

Any ideas are welcome. Coincidentally, I tried reinstalling unicorn and wasn't able to do so. I've only touched the other files mentioned in the Heroku article Deploying Rails Applications with the Puma Web Server The deploy was previously working using unicorn. Thank you in advance for your suggestions. I'm out of ideas and otherwise dead in the water until the Chicago Ruby North Shore MeetUp this weekend!

As mentioned in my comment, gems that are part of the production group won't run in development (unless you purposely run a production environment locally)

If you truly want to run Puma in development (which I recommend), remove it from the production group in your Gemfile and run bundle install again.

so this:

group :production do
  gem 'puma'
end

becomes just:

gem 'puma'  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM