ruby-on-rails – Sprockets文件找不到异常

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Sprockets文件找不到异常前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试一些Rails的示例应用程序.我创造了一些
控制器和页面.但是当我尝试访问其中一个时,我得到一个
网页例外:
Sprockets::FileNotFound in Pages#home
Showing c:/railscode/test_app/app/views/layouts/application.html.erb
where line #6 raised:

couldn't find file 'jquery'
  (in c:/railscode/test_app/app/assets/javascripts/application.js:7)
Extracted source (around line #6):

    3: <head> 
    4:   <title>TestApp</title> 
    5:   <%= stylesheet_link_tag    "application" %> 
    6:   <%= javascript_include_tag "application" %> 
    7:   <%= csrf_Meta_tags %> 8: </head> 9: <body>

Rails.root:`c:/railscode/test_app`

我使用以下命令创建了一些控制器:

$rails generate controller Pages home contact

  create  app/controllers/pages_controller.rb
   route  get "pages/contact"
   route  get "pages/home"
  invoke  erb
  create    app/views/pages
  create    app/views/pages/home.html.erb
  create    app/views/pages/contact.html.erb
  invoke  rspec
  create    spec/controllers/pages_controller_spec.rb
  create    spec/views/pages
  create    spec/views/pages/home.html.erb_spec.rb
  create    spec/views/pages/contact.html.erb_spec.rb
  invoke  helper
  create    app/helpers/pages_helper.rb
  invoke  rspec
  create     spec/helpers/pages_helper_spec.rb
  invoke  assets
  invoke    js
  create      app/assets/javascripts/pages.js
  invoke    css
  create      app/assets/stylesheets/pages.css

只想知道问题可能在哪里和在哪里看?我是
通过URL访问页面http://localhost:3000/pages/home

解决方法

取消评论该行
//= require jquery

在application.js文件中并重新启动应用程序对我有用.

原文链接:https://www.f2er.com/ruby/273843.html

猜你在找的Ruby相关文章