gpt4 book ai didi

ruby-on-rails - Rails 4.1.4:Sprockets::FileNotFound at/admin 找不到文件 'jquery.ui.all'

转载 作者:行者123 更新时间:2023-12-03 01:53:11 26 4
gpt4 key购买 nike

尽管提出了类似的问题,但提出的解决方案都不起作用。

从 Rails 4.0.0 升级到 Rails 4.1.4 之前一切正常。作为调试的一部分,我删除了 Gemfile.lock 并使用“bundle install”重新生成

Rails 4.1.4 ruby 2.0

由于 2.12.x 中的问题无法与 Rails 4.1.4 配合使用,Sprockets 仅限于 2.11.0。 sass-rails 限制为 4.0.2。作为约束 sprockets 版本同一问题的一部分。

gem 文件:

source 'https://rubygems.org'

gem 'rails', '= 4.1.4'
gem 'sass-rails', '4.0.2'
gem 'haml-rails'
gem 'coffee-rails'

gem 'jquery-rails'
gem 'jquery-ui-rails'

gem 'uglifier'
gem 'therubyracer'
gem 'turbolinks'

group :development do
gem 'thin'
gem 'erb2haml'

gem 'capistrano'
gem 'rvm-capistrano'
gem 'rspec-rails'
end
gem 'jbuilder'

gem 'mysql2', '~> 0.3.12b5'

gem "sprockets", "2.11.0"
gem 'better_errors', group: :development
gem 'sprockets_better_errors', group: :development
gem 'binding_of_caller', group: :development
gem 'quiet_assets', group: [:development, :test]

# Lots more gems omitted...

摘自 Gemfile.lock:

jquery-rails (3.1.1)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
jquery-ui-rails (5.0.0)
railties (>= 3.2.16)

包含 jquery.ui.all 行的 CoffeeScript:

#= require active_admin/base
#= require jquery
#= require jquery_ujs
#= require jquery.ui.all

来自“bundle exec rake assets:precompile”的实际错误:

03:58:54:website >> bundle exec rake assets:precompile
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.1.4/lib/action_dispatch/http/mime_type.rb:163: warning: already initialized constant Mime::VCF
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/actionpack-4.1.4/lib/action_dispatch/http/mime_type.rb:163: warning: previous definition of VCF was here
rake aborted!
Sprockets::FileNotFound: couldn't find file 'jquery.ui.all'
(in /Users/mwlang/projects/clients/law/site/website/app/assets/javascripts/active_admin.js.coffee:4)
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/context.rb:106:in `resolve'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/context.rb:146:in `require_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:217:in `process_require_directive'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:167:in `block in process_directives'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:165:in `each'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:165:in `process_directives'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/directive_processor.rb:99:in `evaluate'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/context.rb:197:in `block in evaluate'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `each'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/context.rb:194:in `evaluate'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `new'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:373:in `build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `new'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:377:in `build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:in `build_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in `find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:in `find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:in `benchmark'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in `find_asset'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:in `block in compile'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `each'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in `compile'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/bin/ruby_noexec_wrapper:14:in `eval'
/Users/mwlang/.rvm/gems/ruby-2.0.0-p451/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => assets:precompile

最佳答案

深入研究后,发现在项目的 javascript 和样式表中包含 jquery-ui-rails 的语法已更改! Rails 4.1.x 的工作解决方案是:

在您的 Gemfile 中,只需包含 gem:

gem 'jquery-ui-rails'

您不需要指定源或分支。

而不是旧的方式(对于所有事情):

#= require jquery.ui.all

您现在应该使用:

#= require jquery-ui

注意“。”变成“-”

如果您想包含特定组件,那也会发生变化。而不是:

#= require jquery.ui.sortable

现在:

#= require jquery-ui/sortable

关于ruby-on-rails - Rails 4.1.4:Sprockets::FileNotFound at/admin 找不到文件 'jquery.ui.all',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24767166/

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