gpt4 book ai didi

jquery - Sprockets::FileNotFound 找不到文件 'jquery'

转载 作者:行者123 更新时间:2023-12-03 22:41:31 28 4
gpt4 key购买 nike

我是 Rails 新手,我被困在这个地方。

这是我的应用程序。HTML.erb 错误出现在 JavaScript include 标记中(第 6 行)当我删除该行时,我没有收到错误我尝试执行以下操作没有成功 couldn't find file 'jquery' in Rails project我重新启动服务器几次并没有帮助最后一件事,当我打开旧项目时它可以工作,但任何新项目都会出现相同的错误

<!DOCTYPE html>
<html>
<head>
<title>Appmind</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
</head>
<body>

<%= yield %>

</body>
</html>

application.js 的内容

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .

gem文件内容

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

追踪

Rails.root: C:/aptanastudio3/appmind
Application Trace | Framework Trace | Full Trace

app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___663637225_30053304'

如有任何帮助,我们将不胜感激

最佳答案

我发现当我的 gem 'jquery-rails' 被包装在一个组 :assets do block 中时,它不起作用。但我把它从街区上移走了,现在它使用了最现代的 rails 。这与您的情况不同,但我认为换个方式可能会有效。

关于jquery - Sprockets::FileNotFound 找不到文件 'jquery',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22120201/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com