rackup (failed to load command)

纵饮孤独 提交于 2020-01-17 08:01:28

问题


When I type: bundle exec rackupit 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!