贊助廠商

娛樂城推薦

首頁

電腦與網際網路/其他:電腦列表

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.rbchecking for unistd.h... *** extconf.rb failed ***Could not create Makefile due to some reason, probably lack of necessarylibraries and/or headers. Check the mkmf.log file for more details. You mayneed 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 whichcan be found here:/Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/nio4r-2.5.7/mkmf.logextconf failed, exit code 1Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/nio4r-2.5.7for 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.pysavePATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"export PATHexport 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" # LoadRVM into a shell session *as a function*export PATH="$HOME/.rbenv/bin:$PATH"eval "$(rbenv init -)"--
  • 發問日期:2021-06-13 16:20:05

友站連結