0

我在 CentOS 6.6 Linux 上使用 RubyOnRails 4.2.0 构建了网站。我不能对 CoffeeScript 进行资产预编译。gem“therubyracer”运行时似乎发生了错误。只有在 CoffeeScript 不存在时,预编译才会成功。

我使用 gem "therubyracer" ver.0.11.0beta8 和 gem "libv8" ver.3.11.8.3。如何解决?谢谢。

建筑学

# bundle exec ruby -rubygems -e 'puts Gem::Platform.new(RUBY_PLATFORM)'
x86_64-linux

Rails.application.config.assets

irb(main):001:0> y Rails.application.config.assets.compile
--- true
...
=> nil
irb(main):002:0>
irb(main):003:0*
irb(main):004:0* y Rails.application.config.assets.digest
--- true
...
=> nil
irb(main):005:0> y Rails.application.config.assets.enabled
--- true
...
=> nil
irb(main):006:0>
irb(main):011:0* y Rails.application.config.assets.paths
---
- "/opt/redmine-3.0.1/app/assets/javascripts"
- "/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/websocket-rails-0.7.0/lib/assets/javascripts"
- "/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/jquery-rails-3.1.2/vendor/assets/javascripts"
- "/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/coffee-rails-4.1.1/lib/assets/javascripts"
=> nil
irb(main):012:0>
irb(main):013:0* y Rails.application.config.assets.precompile
---
- !ruby/object:Proc {}
- !ruby/regexp /(?:¥/|¥¥|¥A)application¥.(css|js)$/
- "*.coffee"
- "*.js"
- "*.jpg"
- "*.png"
- "*.ttf"
=> nil
irb(main):014:0>
irb(main):015:0* y Rails.application.config.assets.prefix
--- "/assets"
=> nil
irb(main):016:0>

资产目录

# cat app/assets/javascripts/application.js
//= require websocket_rails/main

# ls -ltr /opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/websocket-rails-0.7.0/lib/assets/javascripts/
合計 4
drwxr-xr-x 2 root root 4096  6月 26 18:46 2016 websocket_rails

# ls -ltr /opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/websocket-rails-0.7.0/lib/assets/javascripts/websocket_rails/
合計 32
-rw-r--r-- 1 root root 1742  6月 19 17:53 2016 http_connection.js.coffee
-rw-r--r-- 1 root root  995  6月 19 17:53 2016 event.js.coffee
-rw-r--r-- 1 root root 2292  6月 19 17:53 2016 channel.js.coffee
-rw-r--r-- 1 root root 1237  6月 19 17:53 2016 abstract_connection.js.coffee
-rw-r--r-- 1 root root 4515  6月 19 17:53 2016 websocket_rails.js.coffee
-rw-r--r-- 1 root root  857  6月 19 17:53 2016 websocket_connection.js.coffee
-rw-r--r-- 1 root root  171  6月 19 17:53 2016 main.js
# cat /opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/websocket-rails-0.7.0/lib/assets/javascripts/websocket_rails/main.js
//= require ./websocket_rails
//= require ./event
//= require ./abstract_connection
//= require ./http_connection
//= require ./websocket_connection
//= require ./channel

rake 资产:预编译

# RAILS_ENV=production bundle exec rake assets:precompile --trace
[DEPRECATION] requiring "RMagick" is deprecated. Use "rmagick" instead
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
TypeError: wrong argument type nil (expected Data)
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.11.0beta8-x86_64-linux/lib/v8/context.rb:66:in `New'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.11.0beta8-x86_64-linux/lib/v8/context.rb:66:in `initialize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:10:in `new'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:10:in `block in initialize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:75:in `block in lock'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:73:in `call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:73:in `Locker'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:73:in `lock'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/ruby_racer_runtime.rb:9:in `initialize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/runtime.rb:44:in `new'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/runtime.rb:44:in `compile'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/execjs-2.6.0/lib/execjs/module.rb:27:in `compile'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:50:in `context'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/coffee-script-2.4.1/lib/coffee_script.rb:78:in `compile'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/coffee_script_processor.rb:21:in `block in call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cache.rb:85:in `fetch'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/coffee_script_processor.rb:20:in `call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:73:in `call_processor'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:55:in `block in call_processors'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:54:in `reverse_each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:54:in `call_processors'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:40:in `block in load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:170:in `fetch_asset_from_dependency_cache'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:33:in `load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:47:in `yield'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:47:in `load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/bundle.rb:23:in `block in call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/utils.rb:183:in `dfs'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/bundle.rb:24:in `call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:73:in `call_processor'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:55:in `block in call_processors'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:54:in `reverse_each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/processor_utils.rb:54:in `call_processors'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:103:in `load_asset_by_uri'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:40:in `block in load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:170:in `fetch_asset_from_dependency_cache'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/loader.rb:33:in `load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:47:in `yield'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/cached_environment.rb:47:in `load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/base.rb:63:in `find_asset'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/base.rb:70:in `find_all_linked_assets'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/manifest.rb:138:in `block in find'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/path_utils.rb:223:in `block in stat_tree'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/path_utils.rb:207:in `block in stat_directory'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/path_utils.rb:204:in `each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/path_utils.rb:204:in `stat_directory'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/path_utils.rb:222:in `stat_tree'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/legacy.rb:105:in `each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/legacy.rb:104:in `each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/legacy.rb:104:in `logical_paths'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/manifest.rb:136:in `find'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/sprockets/manifest.rb:162:in `compile'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-3.0.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.2.4/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/opt/redmine-3.0.1/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
Tasks: TOP => assets:precompile
#
4

1 回答 1

0

libv8 维护者在这里。

您使用的 libv8 和 therubyracer 版本较旧,请考虑更新到最新发布的版本。如果您继续收到错误,请考虑在 github 的 ruby​​racer/libv8 问题跟踪器中打开一个问题。

作为旁注,您应该考虑首先直接询问项目的维护人员,例如通过他们的问题跟踪器,然后再在 SO 中提出问题。如果我不是偶然在这里寻找有关 libv8 的最新问题,您的问题可能仍然没有答案。

于 2016-07-11T21:17:32.173 回答