简体   繁体   English

`require':无法加载此类文件-cancan(LoadError)

[英]`require': cannot load such file — cancan (LoadError)

I'm using the CanCan gem with ActiveAdmin. 我正在将CanCan gem与ActiveAdmin一起使用。 It is working as expected in dev, but when pushed to a staging server I get the following error: 它按开发人员的预期运行,但是当推送到登台服务器时,出现以下错误:

`require': cannot load such file -- cancan (LoadError)

In my case, this is caused by the 'require' line in ActiveAdmin's CanCan adapter. 就我而言,这是由ActiveAdmin的CanCan适配器中的“ require”行引起的。

I've searched Google for potential explanations but have come up empty-handed. 我已经在Google上搜索了可能的解释,但是空手而归。

What might be the cause of such an error, and how can I go about fixing it? 这种错误可能是什么原因造成的,我该如何解决呢?

Update: 更新:

Here is my config/initializers/active_admin.rb : 这是我的config/initializers/active_admin.rb

ActiveAdmin.setup do |config|
  config.authentication_method = :authenticate_user!
  config.authorization_adapter = ActiveAdmin::CanCanAdapter
  config.cancan_ability_class = "Ability"
  config.current_user_method = :current_user
  config.logout_link_path = :destroy_user_session_path
  config.allow_comments = false
  config.batch_actions = true
end

Restarting the entire machine fixed this. 重新启动整个计算机可以解决此问题。

I had tried restarting both nginx and unicorn, but I had yet to restart the machine itself. 我曾尝试重新启动nginx和unicorn,但尚未重新启动计算机本身。 For whatever reason, this did the trick. 无论出于何种原因,这都是成功的秘诀。

Thanks for your thoughts / suggestions. 感谢您的想法/建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 `require':无法加载这样的文件 - capybara / rspec(LoadError) - `require': cannot load such file — capybara/rspec (LoadError) `require':无法加载此类文件-mysql(LoadError) - `require': cannot load such file — mysql(LoadError) 'require':无法加载此类文件'gem'(LoadError) - 'require': cannot load such file 'gem' (LoadError) `require':无法加载此类文件-捆绑程序/安装程序(LoadError) - `require': cannot load such file — bundler/setup (LoadError) `require':无法加载此类文件-赛​​璐ul /当前(LoadError) - `require': cannot load such file — celluloid/current (LoadError) `require':无法加载此类文件-rails / all(LoadError) - `require': cannot load such file — rails/all (LoadError) `require':无法加载此类文件-simplecov(LoadError) - `require': cannot load such file — simplecov (LoadError) Rails 控制台:在“require”中:无法加载此类文件 — readline (LoadError) - Rails console: in `require': cannot load such file — readline (LoadError) 脚本/运行程序:3:在“需要”中:无法加载此类文件-命令/运行程序(LoadError) - script/runner:3:in `require': cannot load such file — commands/runner (LoadError) `require':无法加载这样的文件 - rack / cache / entity_store(LoadError) - `require': cannot load such file — rack/cache/entity_store (LoadError)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM