每当我尝试运行服务器时,我都会收到此错误,不确定是否与js运行时有关,我正在使用node和execjs安装。
/Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'rails-api'. (Bundler::GemRequireError)
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from /Users/me/.rvm/gems/ruby-2.2.2@global/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from /Users/me/Documents/Rails/Paid/paid-api/config/application.rb:17:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:88:in `require'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:88:in `block in server'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:85:in `server'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/command.rb:20:in `run'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/railties-5.0.0.beta3/lib/rails/commands.rb:18:in `<top (required)>'
from /Users/me/Documents/Rails/Paid/paid-api/bin/rails:9:in `require'
from /Users/me/Documents/Rails/Paid/paid-api/bin/rails:9:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `load'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/client/rails.rb:28:in `call'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/client/command.rb:7:in `call'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/client.rb:28:in `run'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/bin/spring:49:in `<top (required)>'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `load'
from /Users/me/.rvm/gems/ruby-2.2.2/gems/spring-1.6.4/lib/spring/binstub.rb:11:in `<top (required)>'
from /Users/me/Documents/Rails/Paid/paid-api/bin/spring:13:in `require'
from /Users/me/Documents/Rails/Paid/paid-api/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
我目前的Gemfile,很直接:
source 'https://rubygems.org'
gem 'rails', '>= 5.0.0.beta2', '< 5.1'
gem 'rails-api'
# Concurrent app server
gem 'puma'
gem 'activerecord-import', '~> 0.11.0'
# Message Queuing
gem 'aws-sdk', '~> 2'
# Load Balancing
gem 'shoryuken'
# Salesforce REST api
gem 'restforce'
# PAID ruby-gem
gem 'paid'
group :development, :test do
gem 'rubocop', '~> 0.39.0', require: false
end
group :development do
gem 'spring'
end
group :test do
gem 'rspec-core'
end
group :doc do
gem 'sdoc'
end
我的application.rb文件,差别不大:
require File.expand_path('../boot', __FILE__)
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
# require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "action_cable/engine"
# require "sprockets/railtie"
require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module PaidApi
class Application < Rails::Application
config.active_job.queue_adapter = :shoryuken
end
end
答案 0 :(得分:2)
不确定这是否正是问题,但rails-5已经包含rails-api。将它们放在一起可能会引起问题。