简体   繁体   English

无法在 Rails 中生成用户 Model

[英]Can't generate User Model in Rails

After the MimeMagic dependency fiasco, I'm now unable to generate a model in Rails.在 MimeMagic 依赖失败之后,我现在无法在 Rails 中生成 model。 I've got the following warning message and stack trace error after trying to generate a User model in rails尝试在 rails 中生成用户 model 后,我收到以下警告消息和堆栈跟踪错误

rails generate model User email:string 
password_digest:string
Warning: the running version of Bundler (2.2.3) is 
older than the version that created the lockfile 
(2.2.15). We suggest you to upgrade to the version 
that created the lockfile by running `gem install 
bundler:2.2.15`.

However, my Gemfile is updated to 2.2.15 and I've run bundle install again to no avail.但是,我的 Gemfile 已更新到 2.2.15,并且我再次运行 bundle install 无济于事。

Here is part of the stack trace error after that Warning:这是该警告之后的堆栈跟踪错误的一部分:

/Users/shmeadyy/Desktop/Projects/scheduled_tweets/vendor/bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `require': incompatible library version - /Users/shmeadyy/Desktop/Projects/scheduled_tweets/vendor/bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack/msgpack.bundle (LoadError)
        from /Users/shmeadyy/Desktop/Projects/scheduled_tweets/vendor/bundle/ruby/3.0.0/gems/msgpack-1.4.2/lib/msgpack.rb:8:in `<top (required)>'
        from /Users/shmeadyy/Desktop/Projects/scheduled_tweets/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/store.rb:4:in `require'
        from /Users/shmeadyy/Desktop/Projects/scheduled_tweets/vendor/bundle/ruby/3.0.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/store.rb:4:in `block in <top (required)>'

The bundler used to generate Gemfile is the one globally installed in your ruby gems directory.用于生成 Gemfile 的捆绑器是全局安装在 ruby gems 目录中的捆绑器。

gem environment

and

gem list

will give you more information about your current ruby and gems installation.将为您提供有关当前 ruby 和 gems 安装的更多信息。

You probably added older version of bundler into gemfile, and using bundle command you've switched to an older version.您可能将旧版本的 bundler 添加到 gemfile 中,并使用bundle命令切换到旧版本。

You can try to update global version of bundler by running the prompted您可以尝试通过运行提示来更新捆绑器的全局版本

gem install bundler:2.2.15

In my opinion you should remove bundler entry from gemfile, as each time you'd use bundle command it will switch back to older version unnecessarily.在我看来,您应该从 gemfile 中删除 bundler 条目,因为每次您使用bundle命令时,它都会不必要地切换回旧版本。

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

相关问题 不能使用“ rails g模型用户” - can't use “rails g model user” Rails:Rolify无法生成用户模型,因为它已经存在 - Rails: Rolify can not generate user model because one has existed Ruby on Rails:无法保存与Devise用户关联的概要文件模型 - Ruby on rails: can't save profile model associated with Devise user 无法在用户模型中访问“用户名”属性(Rails 4-Devise) - Can't make 'username' attr accessible in User model (Rails 4 - Devise) rails生成模型后自动t.timestamps,我可以在迁移文件中手动删除吗? - automatic t.timestamps after rails generate model, can I manually remove this in the migration file? 无法更新Rails模型 - can't update rails model 在关联模型中使用Rails用户ID,为什么我不能调用用户信息? - Rails User ID in an associated model, why can't I call the User's information? 无法在Rails_Admin中更新用户并使用belongs_to对用户进行建模:user - Can't update user in Rails_Admin for and model with belongs_to :user 表单字段用户在Rails中不能为空(用户未与表单提交/模型关联) - Form field user can't be blank in rails (user not getting associated with form submission/model) 在Rails中更新模型不会将其与用户关联 - Updating model in Rails doesn't associate it with user
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM