[英]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.