iT邦幫忙

0

ruby安裝問題

https://ithelp.ithome.com.tw/upload/images/20200120/20124361m5MjRfFZsn.png

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中
2
阿展展展
iT邦好手 1 級 ‧ 2020-01-20 06:24:57

https://ithelp.ithome.com.tw/upload/images/20200120/20119546m1rNi14dwY.jpg

咖咖拉 iT邦好手 1 級 ‧ 2020-01-20 09:57:26 檢舉

阿鬼:Ruby to 2.6.0
/images/emoticon/emoticon10.gif

/images/emoticon/emoticon40.gif

0
1
逮丸逮丸
iT邦大師 1 級 ‧ 2020-01-23 09:23:29

建立 windows 環境安裝 ruby

既然是在 windows 環境,
建議安裝 chocolatey 之後,
再用 choco install ruby
來安裝 choco 的 ruby 套件
https://ithelp.ithome.com.tw/upload/images/20200123/20005266o7GY9FNeaA.png

執行出同樣的錯誤訊息

編輯這個檔案: C:\tools\ruby27\lib\ruby\site_ruby\2.7.0\ruby_installer\runtime\ridk.rb
在168行之前加入:
puts h.inspect
來觀察是要印什麼東西出來?
另開 cmd 執行
ridk version
https://ithelp.ithome.com.tw/upload/images/20200123/20005266RmWFyXYlbm.png
原來是 os 的值裡面有 非 utf-8 的訊息,造成 ridk.rb 使用 yaml_tree 造成的問題。

就cmd的編碼來解決

原來 cmd 的編碼是這樣:
https://ithelp.ithome.com.tw/upload/images/20200123/20005266qTLNVGgmWD.png
那就在 cmd 裡執行
chcp 65001
將 cmd 的執行環境改成 utf-8 的環境:
https://ithelp.ithome.com.tw/upload/images/20200123/20005266SbTilUgeTN.png
然後再執行 ridk version 這樣就正常了!
https://ithelp.ithome.com.tw/upload/images/20200123/20005266qqya9dxZ7z.png

參考資料

  1. ArgumentError when execute ridk version on non English version Windows
  2. 在命令提示視窗(Command Prompt)顯示UTF-8內容

我要發表回答

立即登入回答