不知怎的,这是相关的,但我不确定如何/为什么?
刚刚通过RVM的rvm upgrade
命令从Ruby 1.9.2-p180升级到1.9.2-p290 ......现在我的资产管道已经“破损”。
在rvm upgrade ...
期间,我注意到每个gemset的一堆错误沿着以下几行:
ERROR: Error running 'rvm gemset pristine' under ,
please read /Users/meltemi/.rvm/log//gemset.pristine.log
我让升级继续,因为gemset.pristine.log中没有太多有趣的东西... 此外,/Users/meltemi/.rvm/log//gemset.pristine.log
不会(不能?)存在于那个确切的路径中?路径名中连续两个'//'?无论如何......
测试一个小应用程序,虽然它启动并且似乎正在运行它不会加载任何资产(图像,CSS等)。对于这些缺失的资产,开发日志有很多Not Found
错误(见下文),即使它们存在于app/assets/images
和app/assets/stylesheets
等内......?
任何人都知道这里发生了什么?似乎管道已经崩溃了......好像Rails不再知道在app / assets中寻找资产,也许?如何测试/验证/修复/重新激活此“管道”?
$ rails s
=> Booting WEBrick
=> Rails 3.1.0.rc4 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-07-25 23:11:38] INFO WEBrick 1.3.1
[2011-07-25 23:11:38] INFO ruby 1.9.2 (2011-07-09) [x86_64-darwin10.8.0]
[2011-07-25 23:11:38] INFO WEBrick::HTTPServer#start: pid=74881 port=3000
Started GET "/" for 127.0.0.1 at 2011-07-25 23:11:43 -0700
Processing by PostsController#index as HTML
Post Load (0.2ms) SELECT "posts".* FROM "posts" ORDER BY posts.created_at DESC
User Load (0.3ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Photo Load (0.3ms) SELECT "photos".* FROM "photos" WHERE "photos"."post_id" = 6
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."post_id" = 5
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."post_id" = 4
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."post_id" = 2
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Photo Load (0.2ms) SELECT "photos".* FROM "photos" WHERE "photos"."post_id" = 1
Rendered posts/index.html.haml within layouts/application (3016.4ms)
Rendered layouts/_header.html.haml (9.7ms)
Completed 200 OK in 3143ms (Views: 3138.2ms | ActiveRecord: 2.9ms)
Started GET "/assets/application.css" for 127.0.0.1 at 2011-07-25 23:11:47 -0700
Served asset /application.css - 404 Not Found (1ms)
ActionController::RoutingError (No route matches [GET] "/assets/application.css"):
Rendered /Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails3/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms)
Started GET "/assets/application.js" for 127.0.0.1 at 2011-07-25 23:11:47 -0700
Served asset /application.js - 404 Not Found (0ms)
ActionController::RoutingError (No route matches [GET] "/assets/application.js"):
Rendered /Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails3/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.8ms)
Started GET "/assets/racer-outline.png" for 127.0.0.1 at 2011-07-25 23:11:48 -0700
Served asset /racer-outline.png - 404 Not Found (0ms)
ActionController::RoutingError (No route matches [GET] "/assets/racer-outline.png"):
Rendered /Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails3/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (3.2ms)
Started GET "/assets/ray.png" for 127.0.0.1 at 2011-07-25 23:11:48 -0700
Served asset /pogo.png - 404 Not Found (0ms)
ActionController::RoutingError (No route matches [GET] "/assets/ray.png"):
Rendered /Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails3/gems/actionpack-3.1.0.rc4/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.2ms)
答案 0 :(得分:3)
似乎sprockets的2.0.0.beta.11版打破了资产管道。放
gem'sprockets','= 2.0.0.beta.10'
进入你的Gemfile似乎解决了问题(它对我有用)。无论出于何种原因,Rails似乎会自动使用最新版本的测试版,所以如果您最近刚开始创建项目或更新了所有宝石,它可能会破坏它。
请注意,此信息最初不是我的,我从http://groups.google.com/group/rubyonrails-core/browse_thread/thread/59d8c7813b4d1bbe?pli=1
获得了修复他解释了ver的问题。 2.0.0.beta.11但我使用的是ver。 2.0.0.beta.12具有相同的结果,所以它们似乎还没有修复它。
编辑:似乎将rails升级到3.1.rc5也解决了问题
答案 1 :(得分:0)
我最终只是吹灭整个有问题的宝石并重新开始。获得的经验:
不要相信rvm upgrade
。在RVM中安装新的Ruby。然后手动重建(或bundle install
)您的宝石。