Rails 部署 ruby-china,执行 rake assets:precompile 报错.

hlcfan · 2012年03月18日 · 最后由 ichord 回复于 2012年04月15日 · 3773 次阅读

大家好,这是部分记录. rake assets:precompile --trace DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/hlcfan/workspace/ruby-china/config/application.rb:13) ** Invoke assets:precompile (first_time) ** Execute assets:precompile /usr/local/rvm/rubies/ruby-1.9.3-p125/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/hlcfan/workspace/ruby-china/config/application.rb:13) ** Invoke assets:precompile:all (first_time) ** Execute assets:precompile:all ** Invoke assets:precompile:primary (first_time) ** Invoke assets:environment (first_time) ** Execute assets:environment ** Invoke environment (first_time) ** Execute environment ** Invoke tmp:cache:clear (first_time) ** Execute tmp:cache:clear ** Execute assets:precompile:primary rake aborted! 399: unexpected token at '\");\u000a $('span', el).text(\"\" + re + \"��"\");\u000a return $(\"i.icon\", el).attr(\"class\", \"icon small_liked\");\u000a } else {\u000a

so wuts the probs?

看样子和编码有关,没碰到过

bundle exec rake assets:precompile

@huobazi 你好,依然报错. rake aborted! 399: unexpected token at '\");\u000a $('span', el).text(\"\" + re + \"��"\");\u000a return $(\"i.icon\", el).attr(\"class\", \"icon small_liked\");\u000a } else {\u000a return App

(in /home/foo/workspace/ruby-china/app/assets/javascripts/app.coffee)

#3 楼 @hlcfan 需要在 gemfile 添加两个包. 详细教程:http://www.cnblogs.com/likeyu/archive/2012/02/25/2367379.html gem 'execjs' gem 'therubyracer'

#4 楼 @hlcfan 你好,我和你一样的报错,但是,照教程之后仍然如此报错,没有解决,望解答之,谢谢

DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/wwwroot/ruby-china/config/application.rb:13) rake aborted! syntax error on line 5, col 7: ` port: 27018'

Tasks: TOP => sunspot:solr:start => environment (See full trace by running task with --trace)

#5 @yetone 看你这错误好像是没开启 solr 服务. 试试 rake sunspot:solr:start rake sunspot:solr:run 还有预先要启动 mongodb

#7 楼 @diudiutang 谢谢你的回复。但是执行你的命令后还是报错: DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/wwwroot/ruby-china/config/application.rb:13) Rails Error: Unable to access log file. Please ensure that /home/wwwroot/ruby-china/log/development.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. rake aborted! syntax error on line 5, col 7: ` port: 27018'

Tasks: TOP => sunspot:solr:start => environment (See full trace by running task with --trace)

#7 @yetone 这个错误就是你没有 log 文件,新建个 log 文件夹,并赋予读写权限

#9 楼 @diudiutang 十分感谢你的回复,但是我给 log 文件赋予读写权限后,还是有如下错误啊: DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/wwwroot/ruby-china/config/application.rb:13) rake aborted! syntax error on line 5, col 7: ` port: 27018'

Tasks: TOP => sunspot:solr:start => environment (See full trace by running task with --trace)

#10 @yetone DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/wwwroot/ruby-china/config/application.rb:13) 这个错误是 rails 3.2 移除了 ActiveSupport::Memoizable,可以 pass 掉。 你 rake 的时候 --trace 具体看下是哪出错了,目前给的信息判断不了是哪出错了

#10 楼 @yetone config/mongoid.yml 文件的缩进格式有问题,2 个空格的 tab 才是对的

#12 楼 @huacnlee 谢谢帮助。十分感谢!但是,改完缩进后出错信息如下: 'DEPRECATION WARNING: ActiveSupport::Memoizable is deprecated and will be removed in future releases,simply use Ruby memoization pattern instead. (called from at /home/wwwroot/ruby-china/config/application.rb:13) rake aborted! Failed to connect to a master node at 127.0.0.1:27018

Tasks: TOP => sunspot:solr:start => environment (See full trace by running task with --trace) ' 我确定 mongod 已开启,并且/etc/mongodb.conf 中设置的 port 是 27018

@yetone 为什么要设置为27018呢....默认的 27017不好么..不知道这样做会不会和其它的默认端口有冲突. 或者查看下 mongodb 的启动日志. . 查看 mongodb 官方文档的 connectionsSecurity adn AuthenticationPorts 部分. 截取如下:

Ports Default TCP port numbers for MongoDB processes are as follows:

Standalone mongod : 27017 mongos : 27017 shard server (mongod --shardsvr) : 27018 config server (mongod --configsvr) : 27019 web stats page for mongod : add 1000 to port number (28017, by default). Most stats pages in the HTTP UI are unavailable unless the --rest option is specified. To disable the "home" stats page use --nohttpinterface. (This port should be secured, if used, however, the information on the stats home page is read only regardless.) You can change the port number using the 'port' option when starting mongod.

需要 登录 后方可回复, 如果你还没有账号请 注册新账号