[英]Bundler version wrong?
I'm having trouble creating a new Rails app.我在创建新的 Rails 应用程序时遇到问题。 I'm using a fresh WSL2 + Ubuntu 18.04 install.
我正在使用全新的 WSL2 + Ubuntu 18.04 安装。
Long story short, I followed the Rails installation procedure from https://gorails.com/setup/windows/10 but when installing bundle using gem install bundler
, I end up with 2 bundler versions (2.1.2 and 2.1.4).长话短说,我遵循了https://gorails.com/setup/windows/10 中的 Rails 安装程序,但是在使用
gem install bundler
安装 bundle 时,我最终得到了 2 个 bundler 版本(2.1.2 和 2.1.4)。
If I stick with 2.1.2 webpacker throws an error, so I definitely need to install the newest version.如果我坚持使用 2.1.2 webpacker 会抛出错误,所以我肯定需要安装最新版本。 The problem is, when I install 2.1.4 the default version remains 2.1.2, so then I go to
cd /.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/specifications/default
and remove bundler-2.1.2.gemspec
, and then I do a gem install bundler --default
to get only v2.1.4 as default:问题是,当我安装 2.1.4 时,默认版本仍然是 2.1.2,所以我去
cd /.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/specifications/default
并删除bundler-2.1.2.gemspec
,然后我执行gem install bundler --default
以仅获取 v2.1.4 作为默认值:
gem list bundler
*** LOCAL GEMS ***
bundler (default: 2.1.4)
But here is the problem;但问题就在这里; if I run
bundler -v
I get:如果我运行
bundler -v
我得到:
bundler -v
Bundler version 2.1.2
But the real problem is that, when running rails new
, it clearly tries to use 2.1.2 which inevitably fails.但真正的问题是,当运行
rails new
,它显然试图使用 2.1.2,这不可避免地失败。
How can I solve this?我该如何解决这个问题?
Thank you谢谢
尝试gem uninstall bundler --version 2.1.2
。
From the app directory run these commands:从应用程序目录运行这些命令:
gem install bundler
bundle update --bundler
bundle install
This rebuilds the Gemfile.lock with the correct Bundler version.这将使用正确的 Bundler 版本重建 Gemfile.lock。
EDIT: You can create the directory first with rails new my_rails_app
, then do cd .. ; rails new my_rails_app
编辑:您可以先使用
rails new my_rails_app
创建目录,然后执行cd .. ; rails new my_rails_app
cd .. ; rails new my_rails_app
after running the above commands.运行上述命令后
cd .. ; rails new my_rails_app
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.