rails错误记录

错误1

在创建rails的数据库时,rake db:create RAILS_ENV='development'出现如下错误:

Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes.

/home/liuxiaoqin/ruby/depot/config/application.rb:7

/home/liuxiaoqin/ruby/depot/Rakefile:5

 

 

解决方法:

1. 首先安装libv8

gem install 'libv8'

在安装libv8出错,

 

nable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Traceback (most recent call last):
  File "build/gyp/gyp", line 15, in ?
    import gyp
  File "build/gyp/pylib/gyp/__init__.py", line 8, in ?
    import gyp.input
  File "build/gyp/pylib/gyp/input.py", line 14, in ?
    import gyp.common
  File "build/gyp/pylib/gyp/common.py", line 375
    with open(source_path) as source_file:
            ^
SyntaxError: invalid syntax

 

 看上去是GCC的原因实际是python版本的问题,为了跳过这个问题,

使用如下命令:

gem install libv8 --version=3.11.8.3

 

2. 安装rubytracer

gem install therubyracer --version=0.10.2

 

3.安装execjs

gem install execjs

 

4.在Gemfile中添加:

 

gem 'therubyracer'
gem 'execjs'

 

5. bundle install

6.rake db:create RAILS_ENV='development'

成功!

 

错误2

 

/Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': no such file to load -- thin (LoadError)
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler/thin.rb:1
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `const_get'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:269:in `inject'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `each'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `inject'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
	from /Library/Ruby/Gems/1.8/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
	from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands/server.rb:59:in `start'
	from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:55
	from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
	from /Library/Ruby/Gems/1.8/gems/railties-3.2.8/lib/rails/commands.rb:50
	from ./script/rails:6:in `require'
	from ./script/rails:6

 在GemFile中添加 gem 'thin'即可。

 

Rails中安装mysql2错误

gem install mysql2 -- --sicdir=/usr/local/mysql/include/

即可

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值