两天以来,我再也无法在我的 ruby on rails 项目中编译 javascript 资产了。如果我不运行预编译命令,当 ruby 在运行时编译资产时会发生同样的错误。'rake assets:precompile' 命令由于分段错误而中止:
bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
sh: regel 1: 15071 Segmentatiefout node /tmp/execjs20120417-15062-69pd5q.js 2>&1
rake aborted!
["ok","(function() {\n\n\n\n}).call(this);\n"]
(in /home/Roseboom/gitControlled/ror/livescore/app/assets/javascripts/clubs.js.coffee)
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:150:in `exec_runtime'
[.... Remaining stacktrace below this post for the sake of readability ]
在这里,“Segmentatiefout”是荷兰语的“Segmentation fault”。起初,我以为我的项目搞砸了,于是我开始恢复更改以隔离“坏”更改。当这没有帮助时,我在一个我几周没有遇到困难的项目中尝试了“bundle exec rake assets:precompile”,这让我遇到了同样的分段错误。
现在我试图找到这个“execjs20120417-15062-69pd5q.js”文件来删除它。即使在 unix 'find' 命令的帮助下,我也找不到。即使中止,也可能会清除此临时文件。
我尝试的下一件事是重新安装 rake,这对我没有帮助。虽然在运行 'rake assets:precompile' 时发生了同样的错误,但我也尝试重新安装 bundler。这也没有奏效。
接下来的事情有点严格,我在我的系统上重新安装了 ruby 和 rails。不幸的是,根本没有改变。Rails 版本是 3.2.2,重新安装后是 3.2.3。
我尝试的最后一件事是卸载 gem execjs,然后重新安装它,但也没有任何帮助。
将 RAILS_ENV 更改为 development 也不会改变任何内容。
当我清除我的 app/assets/javascripts 文件夹时,我可以预编译,我可以运行我的应用程序(如Rails assets precompile 神秘错误中所述)。我希望 ruby 能够使用之前成功编译的资产。但是,这意味着我永远无法更改 app/assets/javascripts 的内容,这是不可取的。如果我删除了所有的 .js.coffee 文件,那么剩下的 .js 文件就会出现分段错误。
文件 clubs.js.coffee 是自动生成的,我从未更改过。它是几周前生成的,在两天前之前从未给我带来任何问题。如果我删除它,那么另一个 .coffe 或 .js 文件也会发生同样的错误。clubs.js.coffee 包含:
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
我对此真的没有想法。在此先感谢您的帮助。
完整的堆栈跟踪:
bundle exec rake assets:precompile --trace
** Invoke assets:precompile (first_time)
** Execute assets:precompile
/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125/bin/ruby /home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake assets:precompile:
all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
sh: regel 1: 15936 Segmentatiefout node /tmp/execjs20120417-15927-1ka3s2r.js 2>&1
rake aborted!
["ok","(function() {\n\n\n\n}).call(this);\n"]
(in /home/Roseboom/gitControlled/ror/livescore/app/assets/javascripts/clubs.js.coffee)
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:150:in `exec_runtime'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:27:in `block in exec'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:40:in `compile_to_tempfile'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:26:in `exec'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:18:in `eval'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/execjs-1.3.0/lib/execjs/external_runtime.rb:32:in `call'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/coffee-script-2.2.0/lib/coffee_script.rb:57:in `compile'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/tilt-1.3.3/lib/tilt/coffee.rb:46:in `evaluate'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/context.rb:177:in `block in evaluate'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/context.rb:174:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/context.rb:174:in `evaluate'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:12:in `initialize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `new'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `block in build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:262:in `circular_call_protection'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:240:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:89:in `block in build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:88:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:163:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:56:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:106:in `block in build_required_assets'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:100:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:100:in `build_required_assets'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/processed_asset.rb:16:in `initialize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `new'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:241:in `block in build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:262:in `circular_call_protection'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:240:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:89:in `block in build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:88:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:163:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:56:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/bundled_asset.rb:16:in `initialize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:244:in `new'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:244:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:89:in `block in build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/caching.rb:19:in `cache_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:88:in `build_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:163:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/index.rb:56:in `find_asset'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/static_compiler.rb:20:in `block in compile'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:212:in `block in each_logical_path'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:200:in `block (2 levels) in each_file'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:190:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:190:in `each_entry'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:198:in `block in each_file'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:197:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:197:in `each_file'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/sprockets-2.1.2/lib/sprockets/base.rb:210:in `each_logical_path'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/static_compiler.rb:18:in `compile'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:56:in `internal_precompile'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:70:in `block (3 levels) in <top
(required)>'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125/lib64/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:60:in `block (3 levels) in <top
(required)>'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125/lib64/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `load'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile:primary
rake aborted!
Command failed with status (1): [/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125...]
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils.rb:53:in `block in create_shell_runner'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `call'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils.rb:45:in `sh'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `sh'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils.rb:80:in `ruby'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/file_utils_ext.rb:39:in `ruby'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/actionpack-3.2.3/lib/sprockets/assets.rake:29:in `block (2 levels) in <top
(required)>'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/home/Roseboom/.rvm/rubies/ruby-1.9.3-p125/lib64/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `load'
/home/Roseboom/.rvm/gems/ruby-1.9.3-p125/bin/rake:19:in `<main>'
Tasks: TOP => assets:precompile