ruby-on-rails - 我该如何修复这个 MacOS(m1) Ruby Mess
问题描述
MacOS 新手,尝试安装 ruby 并愚蠢地使用 sudo,最终在我的 ruby 2.6 系统版本中使用了 Gems。
我尝试使用 brew 来更正此问题以安装新版本的 ruby,但是当我使用“rails new appname”时,gems 仍安装在系统目录中
红宝石-v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
哪个 Ruby 返回以下内容(对我来说看起来不正确)
/opt/homebrew/opt/ruby/bin/ruby
如果我运行 rails new app 我会得到以下信息
Using rake 13.0.6
Following files may not be writable, so sudo is needed:
/Library/Ruby/Gems/2.6.0
/Library/Ruby/Gems/2.6.0/build_info
/Library/Ruby/Gems/2.6.0/build_info/nokogiri-1.12.2-x86_64-darwin.info
/Library/Ruby/Gems/2.6.0/cache
/Library/Ruby/Gems/2.6.0/doc
/Library/Ruby/Gems/2.6.0/extensions
/Library/Ruby/Gems/2.6.0/gems
/Library/Ruby/Gems/2.6.0/specifications
/usr/local/bin
.....
.....
Bundle complete! 17 Gemfile dependencies, 73 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
rails webpacker:install
rails aborted!
LoadError: dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle, 0x0009): could not use '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle' because it is not a compatible arch - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.3/lib/ffi_c.bundle
我的路径如下
/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
关于如何让这个工作的任何想法,到目前为止我能找到的所有文档都没有帮助。
解决方案
推荐阅读
- java - 耗时的 JavaRDD 方法 take()
- asp.net-core - .Net Core Web API 在从 http 转换为 https 后无法使用 IdentityServer 验证请求
- python - 移动平均函数
- python-3.x - 如何在 Lambda 中将函数从 python file1 导入到 file2
- awk - 如何将 awk 中的浮点数分成两个值?
- laravel - 使用 webhook url twilio laravel 呼叫阻止特定号码
- sql-server - DACPAC 文件没有意义
- c# - 将逗号分隔的字符串作为第二个参数传递给批处理文件 C#
- linux - 使用输入而不是键盘执行命令是什么意思?
- r - 透视没有键值对的表