Rails : ExecJS::ProgramError: RangeError: Maximum call stack size exceeded

Rails : ExecJS::ProgramError: RangeError: Maximum call stack size exceeded

当我在 ENV=production

上将资产编译为 运行 项目时
RAILS_ENV=production bundle exec rake assets:precompile

错误:

ExecJS::ProgramError: RangeError: Maximum call stack size exceeded (in /home/kop/rails/donghoxteen/vendor/assets/javascripts/spree/frontend/all.js) token ((execjs)) skip_line_comment ((execjs):2359:14462) handle_slash ((execjs):2359:16320) next_token ((execjs):2359:17382) skip_line_comment ((execjs):2359:14521) handle_slash ((execjs):2359:16320) next_token ((execjs):2359:17382) skip_line_comment ((execjs):2359:14521) handle_slash ((execjs):2359:16320) next_token ((execjs):2359:17382) skip_line_comment ((execjs):2359:14521) handle_slash ((execjs):2359:16320) next_token ((execjs):2359:17382) skip_line_comment ((execjs):2359:14521) handle_slash ((execjs):2359:16320) /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:47:in rescue in block in call' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:44:inblock in call' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:75:in block in lock' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:incall' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:in Locker' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:inlock' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:43:in call' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/uglifier-2.7.1/lib/uglifier.rb:212:inrun_uglifyjs' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/uglifier-2.7.1/lib/uglifier.rb:179:in compile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/uglifier_compressor.rb:25:inevaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/tilt-1.4.1/lib/tilt/template.rb:103:in render' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:197:inblock in evaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in each' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:inevaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/bundled_asset.rb:25:in initialize' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:innew' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in build_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:inblock in build_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in cache_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:inbuild_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:infind_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:211:in block in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:257:inbenchmark' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:210:in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:119:inblock in compile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in each' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:incompile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in block (3 levels) in define' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/rake/sprocketstask.rb:146:inwith_logger' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in block (2 levels) in define' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/bin/ruby_executable_hooks:15:ineval' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/bin/ruby_executable_hooks:15:in <main>' V8::Error: Maximum call stack size exceeded at token (<eval>:1:0) at skip_line_comment (<eval>:2359:14462) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) at next_token (<eval>:2359:17382) at skip_line_comment (<eval>:2359:14521) at handle_slash (<eval>:2359:16320) /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:45:inblock in call' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:75:in block in lock' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:incall' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:in Locker' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:73:inlock' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/execjs-2.5.2/lib/execjs/ruby_racer_runtime.rb:43:in call' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/uglifier-2.7.1/lib/uglifier.rb:212:inrun_uglifyjs' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/uglifier-2.7.1/lib/uglifier.rb:179:in compile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/uglifier_compressor.rb:25:inevaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/tilt-1.4.1/lib/tilt/template.rb:103:in render' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:197:inblock in evaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:in each' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/context.rb:194:inevaluate' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/bundled_asset.rb:25:in initialize' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:innew' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in build_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:inblock in build_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in cache_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:inbuild_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:infind_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:211:in block in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:257:inbenchmark' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:210:in find_asset' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:119:inblock in compile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in each' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:incompile' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:70:in block (3 levels) in define' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-2.12.4/lib/rake/sprocketstask.rb:146:inwith_logger' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/gems/sprockets-rails-2.3.2/lib/sprockets/rails/task.rb:69:in block (2 levels) in define' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/bin/ruby_executable_hooks:15:ineval' /home/kop/.rvm/gems/ruby-2.1.4@rails3213/bin/ruby_executable_hooks:15:in `' Tasks: TOP => assets:precompile (See full trace by running task with --trace)

在我的文件配置中 env=Product :

  Rails.application.configure do
      config.cache_classes = false
      config.eager_load = false
      config.consider_all_requests_local       = true
      config.action_controller.perform_caching = false
      config.action_mailer.raise_delivery_errors = false
      config.active_support.deprecation = :log
      config.active_record.migration_error = :page_load
      config.assets.debug = true
      config.assets.raise_runtime_errors = true
    end

如何修复这个错误。请帮助我 谢谢大家。

欢迎来到 Stack Overflow。您的问题似乎是堆栈溢出。也就是说,你有太多的嵌套函数调用。

最有可能的是,堆栈溢出是由意外的无限 recursions 引起的。你可以看到在重复行

...
at next token (<eval>:2359:17382)
at skip_line_comment (<eval>:2359:14521)
at handle_slash (<eval>:2359:16320)
...

你必须检查,为什么它们被称为递归以及它是否适用于它们。

我通过删除 application.js

引用的空 js 文件解决了非常相似的问题