省略安裝 ri 及 Rdoc指令
gem install --no-ri --no-rdoc 套件名稱 -v '版本'
本BLOG主要以自我學習備忘用,歡迎指教..^^
bundle install 提示缺少json 1.7.0
安裝 json
gem install json -v '1.7.0'
發生錯誤
"""$ gem install json Building native extensions. This could take a while... ERROR: Error installing json: ERROR: Failed to build gem native extension. c:/Ruby193/bin/ruby.exe extconf.rb creating Makefile make generating parser-i386-mingw32.def compiling parser.c cc1.exe: error: unrecognized command line option "-Wno-missing-field-initializers" make: *** [parser.o] Error 1 Gem files will remain installed in c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0 for inspection. Results logged to c:/Ruby193/lib/ruby/gems/1.9.1/gems/json-1.7.0/ext/json/ext/parser/gem_make.out"""
檢查錯誤 出在 cc1.exe, 先拜Google
查出問題在於 Ruby - DevKit 版本 我安裝錯誤!! 裝到舊版本的DevKit了 XD
DevKit-3.4.5 available at our archive downloads page. For RubyInstaller versions 1.8.7, 1.9.2, and 1.9.3 use the DevKit 4.5.2 from our main downloads page.C:\DevKit. NOTE: the SFX is really a 7-Zip archive with a bit of embedded magic. If you already have 7-Zip
installed, you can simply right-click it and extract its contents as
you would a normal 7z archive. In the instructions that follow, the
directory that you selected is identified as .cd from Step 3 above.ruby dk.rb init to generate the config.yml
file to be used later in this Step. Your installed Rubies will be listed
there (only those installed by a RubyInstaller package are detected at
present).config.yml file to include installed Rubies not automagically discovered or remove Rubies you do not want to use the DevKit with.ruby dk.rb review to review the list of Rubies to be enhanced to use the DevKit and verify the changes you made to it are correct.ruby dk.rb install to DevKit enhance your installed Rubies. This step installs (or updates) an operating_system.rb file into the relevant directory needed to implement a RubyGems pre_install hook and a devkit.rb helper library file into \lib\ruby\site_ruby . NOTE: you may need to use the --force option to update (with backup of the originals) the above mentioned files as discussed at the SFX DevKit upgrade FAQ entry.gem install rdiscount --platform=ruby. RDiscount should install correctly and you should see Temporarily enhancing PATH to include DevKit... in the screen messages. Next run ruby -rubygems -e "require 'rdiscount'; puts RDiscount.new('**Hello RubyInstaller**').to_html" to confirm that the rdiscount gem is working.gem install rdiscount --platform=ruby 第二步驟..省略C:\DevKit>ruby dk.rb init
[INFO] found RubyInstaller v1.9.3 at C:/Ruby193
Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.
C:\DevKit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.
C:/Ruby193
C:\DevKit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Ruby193'
[INFO] Installing 'C:/Ruby193/lib/ruby/site_ruby/devkit.rb'
C:\DevKit>gem install rdiscount --platform=ruby
Fetching: rdiscount-1.6.8.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed rdiscount-1.6.8
1 gem installed
Installing ri documentation for rdiscount-1.6.8...
Installing RDoc documentation for rdiscount-1.6.8...
再回到發生錯誤的地方 # bundle install 應該就能跳過 cc1.exe的錯誤了^^萬歲
RVM自動生成:
~/.bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
~/.bashrc
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
sudo apt-get install libperl-dev gcc libjpeg62-dev libbz2-dev libtiff4-dev libwmf-dev libz-dev \ libpng12-dev libx11-dev libxt-dev libxext-dev libxml2-dev libfreetype6-dev liblcms1-dev \ libexif-dev perl libjasper-dev libltdl3-dev graphviz gs-gpl pkg-config
※Ubuntu 12.04 : gs-gpl套件己被移除
# rails s /home/ericbbs/.rvm/gems/ree-1.8.7-2012.02/gems/execjs-1.3.1/lib/execjs/runtimes. rb:50:in `autodetect': Could not find a JavaScript runtime. See https://github.c om/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavaila ble)
發生(ExecJS::RuntimeUnavailable) 錯誤
修改Gemfile 並加入以下二行
gem 'execjs' gem 'therubyracer'
重新bundle install