当我在我的Rails 5项目上运行
我尝试了许多方法。
根据这篇帖子,我尝试了以下建议:
我还参考了Go Rails指南中的“Final Steps”部分,该部分涉及需要C扩展的gems,但由于我没有从Mojave迁移我的macOS,所以该命令似乎不适用。
目前为止,我不知道下一步该尝试什么。最终问题似乎围绕着无法安装需要C扩展的gems。
环境:
- macOS Monterey版本
bundle install
时,我会在具有本地扩展的宝石上遇到许多错误。以下是其中一个宝石输出的顶部内容:Installing nio4r 1.2.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
checking for unistd.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_without_gvl()... yes
checking for sys/select.h... yes
checking for poll.h... yes
checking for sys/epoll.h... no
checking for sys/event.h... yes
checking for sys/queue.h... yes
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile
current directory: /Users/<my-username>/.rvm/gems/ruby-2.7.4/gems/nio4r-1.2.1/ext/nio4r
make "DESTDIR=" clean
current directory: /Users/<my-username>/.rvm/gems/ruby-2.7.4/gems/nio4r-1.2.1/ext/nio4r
make "DESTDIR="
compiling monitor.c
monitor.c:91:24: warning: '(' and '{' tokens introducing statement expression appear in different macro expansion contexts [-Wcompound-token-split-by-macro]
if(interests_id == rb_intern("r")) {
^~~~~~~~~~~~~~
/Users/<my-username>/.rvm/rubies/ruby-2.7.4/include/ruby-2.7.0/ruby/ruby.h:1847:23: note: expanded from macro 'rb_intern'
__extension__ (RUBY_CONST_ID_CACHE((ID), (str))) : \
^
monitor.c:91:24: note: '{' token is here
if(interests_id == rb_intern("r")) {
^~~~~~~~~~~~~~
我尝试了许多方法。
根据这篇帖子,我尝试了以下建议:
# didn't fix it
bundle config build.nio4r --with-cflags="-std=c99"
bundle
# didn't fix it
xcode-select --install
sudo xcodebuild -license accept
bundle
我还参考了Go Rails指南中的“Final Steps”部分,该部分涉及需要C扩展的gems,但由于我没有从Mojave迁移我的macOS,所以该命令似乎不适用。
目前为止,我不知道下一步该尝试什么。最终问题似乎围绕着无法安装需要C扩展的gems。
环境:
- macOS Monterey版本
12.2
- 使用rvm与ruby版本2.7.4
- 项目使用rails版本5.0.1
bundle clean --force
清理你的 gem 并重新安装吗?有时候,多个 gem 版本会引起很多问题,但并不会明确显示原因。 - brcebn在任何来源中都找不到activesupport-5.0.1
。 - Neilbundle clean
失败的情况。我倾向于使用rm
删除 bundle 并重新构建:rm -r vendor/bundle; bundle install
(假设你的 bundle 位于vendor/bundle
)。但这并不能解决构建问题。 - JellicleCat