新手问题 Rails 4 中使用 rails_kindeditor 在 production 环境下编译找不到文件

zxw6607 · 2015年10月30日 · 最后由 stone 回复于 2015年11月04日 · 2777 次阅读

环境:rails4 rails_kindeditor:0.4.5 最新版

问题:在启动生产模式之前,先进行预编译 rake assets:precompile 报下面错误:

rake assets:precompile

rake aborted! TypeError: unknown filter type: #Pathname:kindeditor/kindeditor.js /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/sprockets/legacy.rb:296:in compile_match_filter' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:125:inblock in find' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:125:in map' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:125:infind' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/sprockets/manifest.rb:162:in compile' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:inblock (3 levels) in define' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-3.4.0/lib/rake/sprocketstask.rb:147:in with_logger' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:inblock (2 levels) in define' Tasks: TOP => assets:precompile (See full trace by running task with --trace)

有遇到此问题么 TX?有大神知道怎么解决么?

@Macrow,你知道怎么解决么?

我也遇到同样问题,然后翻历史旧帖子找到解决办法的,你搜搜

把报错信息粘到谷歌。前面几条就有答案. 链接地址

同楼主,我找了几乎所有的资料都没能解决,最后在 github 里提了 issue,最终有人提出了解决方案,但是那是我已经换成了 ckeditor 了。https://github.com/Macrow/rails_kindeditor/issues/79

汗,google 用不了,用的 bing,找到下面的帖子 · https://ruby-china.org/topics/26085

我改了 sprockets 的版本到 2.12.3,但是现在又报下面的错误

bundler exe rake assets:precompile rake aborted! LoadError: cannot load such file -- hike /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in require' /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:inblock in require' /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in load_dependency' /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:inrequire' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-2.12.3/lib/sprockets.rb:43:in <module:Sprockets>' /usr/local/rvm/gems/ruby-2.2.2/gems/sprockets-2.12.3/lib/sprockets.rb:3:in' /usr/local/rvm/gems/ruby-2.2.2/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require' 正在调查中,实在不行就换其他人做的 gem 包吧

@317583395 还是用你提的那个 issue 里的解决方案,搞定了,多谢 LS 的 TX 们

https://github.com/Macrow/rails_kindeditor#user-content-rails4-in-production-mode-1 文档说 4.0 以上执行 rake kindeditor:assets,是不是这个原因

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