装完rails后创建应用程序:
rails new demo
进入创建的demo文件夹
cd demo
检查安装环境
rake about
这时出现错误
Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.
解决办法:
引用两个gem:execjs和therubyracer,在应用跟目录下的GemFile中添加:
gem ‘execjs’ gem ’therubyracer‘
此时运行
rake about
如果提示
Could not find gem 'therubyracer (>= 0) ruby' in the gems available on this machine. Run `bundle install` to install missing gems.
则执行bundle install
此问题的另一解决方法是安装nodejs:
yum install nodejs
-------------------
另外遇到的一个问题是
cannot load such file -- sqlite3/sqlite3_native
解决办法:
打开文件
vi /usr/local/share/gems/gems/sqlite3-1.3.8/lib/sqlite3.rb
将第二个require后面的路径改为:
'/usr/local/share/gems/gems/sqlite3-1.3.8/ext/sqlite3/sqlite3_native'