贊助廠商

娛樂城推薦

首頁

刊登資訊

  • 刊登者:匿名
  • 時間:2021-06-13 16:20:05

尚未解答Ruby- 安裝rails問題

Ruby- 安裝rails問題

各位大能好
我在輸入sudo gem install rails時
跑出了最下面那一大串敘述
幾乎不懂

我是看網路教學影片 其中用RVM管理ruby
但後來發現這臺mac原本有舊的rbenv跟ruby 導致有點衝突
這兩天我上網胡亂抓藥 好像亂碰了PATH
現在有點不知道該怎麼重新開始回到最初

所以想來此求助 如何解決這問題
重新上學習rails的軌道

btw 我現在透過rbenv 明明是裝 ruby 3.0.0
但我輸入 ruby -v
卻出現ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
可能也是胡亂抓藥的後遺症

因為我對mac的系統本身還不太熟
如果有大大有點空閒時間可以幫我看看 非常感激

===============
以下這大串:

Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.6.0/gems/nio4r-2.5.7/ext/nio4r
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20210306-936-1vp5f2q.rb extconf.rb
checking for unistd.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir

--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in
`block in try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in
`with_werror'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in
`try_compile'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in
`block in have_header'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in
`block in checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block (2 levels) in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in
`postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
`checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in
`have_header'
from extconf.rb:15:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which
can be found here:


/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/nio4r-2.5.7/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/nio4r-2.5.7
for inspection.
Results logged to
/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/nio4r-2.5.7/gem_make.out

============
另外這是目前 vi .bash_profile 打開的內容
但我查到怎麼打開 但不知道怎麼編輯.....
我只會開了編輯模式 但不知道怎麼存檔離開 Orz...
話說我還從-bath 換去了 -zsh
真的是胡亂抓藥 懇請大神救救我

eval '$(rbenv init -)'
export PATH='$HOME/.rbenv/shims:$PATH'
eval '$(rbenv init -)'
export PATH='$HOME/.rbenv/shims:$PATH'
eval '$(rbenv init -)'
export PATH='$HOME/.rbenv/shims:$PATH'
eval '$(rbenv init -)'
export PATH='$HOME/.rbenv/shims:$PATH'

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH='/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}'
export PATH

export PATH='$HOME/.rbenv/bin:$PATH'
eval '$(rvm init -)'

export PATH='$HOME/.rbenv/bin:$PATH'
eval '$(rbenv init -)'

[[ -s '$HOME/.rvm/scripts/rvm' ]] && source '$HOME/.rvm/scripts/rvm' # Load
RVM into a shell session *as a function*
export PATH='$HOME/.rbenv/bin:$PATH'
eval '$(rbenv init -)'




--

0個答案 Ruby- 安裝rails問題

其他問題

友站連結