gpt4 book ai didi

jquery - application.js 不编译或加载 coffeescript

转载 作者:数据小太阳 更新时间:2023-10-29 08:46:54 24 4
gpt4 key购买 nike

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
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
//= require jquery
//= require jquery_ujs
//= require datepicker
//= require_tree .
;

和我的 gemfile

source 'https://rubygems.org'

gem 'rails', '~>3.1.0'
gem 'thor','>=0.14.4'
gem 'nifty-generators'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'will_paginate'
gem 'execjs'
gem 'therubyracer', :platform => :ruby
gem 'rbbcode'
gem 'carrierwave'
gem 'mini_magick'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails'
gem 'coffee-rails'
gem 'bootstrap-sass', '2.3.2.0'
gem 'sprockets', '~>2.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platform => :ruby

gem 'uglifier'
end

gem 'jquery-rails'

不知何故,它不加载任何东西。我尝试预编译它们,但它显示错误

rake aborted!
ExecJS::RuntimeError:
(in c:/Ruby193/lib/ruby/gems/1.9.1/gems/jquery-rails-3.1.1/vendor/assets/javascripts/jquery.min.js)

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

我尝试了一些解决方案,例如将我的 ruby​​ 从 2.0.0 降级到 1.9.3,但它不起作用。另外 rails 版本是 3.1.0

整个--trace预编译

$ bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to s
kip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

…… C:\Users\WebDev\AppData\Local\Temp\execjs20140806-8216-16s9hrzjs(487, 5) (null): 函数不正确。

rake aborted!
ExecJS::RuntimeError:
(in c:/Ruby193/lib/ruby/gems/1.9.1/gems/jquery-rails-3.1.1/vendor/assets/javascripts/jquery.min.js)

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

最佳答案

希望您在生产模式下进行尝试。请将 gem 'therubyracer', :platforms => :ruby 替换为 Gemfile 中的以下代码,

group :development do
gem 'therubyracer', :platforms => :ruby
end

并运行bundle install

另请引用https://stackoverflow.com/a/16784942/1896986

希望对您有所帮助:)

关于jquery - application.js 不编译或加载 coffeescript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25172043/

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