问题
When I type: bundle exec rackup
it should give some output like this:
$ bundle exec rackup
[2017-01-29 21:45:56] INFO WEBrick 1.3.1
[2017-01-29 21:45:56] INFO ruby 2.4.0 (2016-12-24) [x86_64-darwin15]
[2017-01-29 21:45:56] INFO WEBrick::HTTPServer#start: pid=48002 port=9292
But instead I get this
bundler: failed to load command: rackup (/Users/username/.rbenv/versions/2.4.0/bin/rackup)
LoadError: cannot load such file -- rails/all
« truncated »
Here is my gem file:
# frozen_string_literal: true
source "https://rubygems.org"
# gem "rails"
gem 'rspec', '~> 3.6.0.beta2'
gem 'coderay', '~> 1.1', '>= 1.1.1'
gem 'rack-test', '~> 0.6.3'
gem 'sinatra', '~> 1.4', '>= 1.4.8'
Any idea what the problem might be? I am stuck on this for quiet a while.
回答1:
Solved:
In the config.ru
file I defined a rackup
config file but didn't delete the old one.
So
require_relative 'config/environment'
require_relative 'app/api.rb'
run Rails.application
run ExpenseTracker::API.new
Became
require_relative 'app/api.rb'
run ExpenseTracker::API.new
来源:https://stackoverflow.com/questions/42558890/rackup-failed-to-load-command