gpt4 book ai didi

windows - 抽取 Assets :precompile doesn't work (rails 3. 1.1)

转载 作者:可可西里 更新时间:2023-11-01 13:00:05 28 4
gpt4 key购买 nike

我正在部署到 heroku,但我发现没有提供 css 文件(在 heroku 上也找不到它们)。

我读到我需要首先在本地执行 rake assets:precompile 但是当我这样做时我得到:

C:\project>bundle exec rake assets:precompile --trace

** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
undefined: Unexpected token: operator (<)
(in C:/project/app/assets/javascripts/application.js)

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

我在 application.js 中什么都没有,所以我不明白错误在哪里..

application.js 是

// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require jquery
//= require jquery_ujs
//= require_tree .

谢谢

更新

如果删除 .js.erb 文件,我会收到以下错误

C:\project>bundle exec rake assets:precompile RAILS_ENV=production --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
rake aborted!
706: unexpected token at 'C:\Users\me\AppData\Local\Temp\execjs20111021-6448-ei2nm3.js(2, 3) Microsoft JScript runtime error: Out of memory

'
(in C:/project/app/assets/javascripts/application.js)

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

erb css 和 js 文件无法编译时仍然存在问题...

这似乎没有结束..谢谢

最佳答案

我一直在努力尝试部署到暂存服务器。对我有用的解决方案是确保您的 config/environments/[your_environment].rb 文件中包含以下内容:

config.assets.compress = false

默认情况下,压缩器在生产环境以外的环境中不可用,这就是预编译失败的原因。

关于windows - 抽取 Assets :precompile doesn't work (rails 3. 1.1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7845585/

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