从 2.7.0.beta7 升级到 2.7.0.beta9 时出现“_theme_qunit_helper”解析错误

又到了我定期遭遇 Discourse 升级失败的时候了……

从 2.7.0.beta7 升级到 2.7.0.beta9

我通过 Web 控制台升级 Docker Manager 应用时一切顺利。

随后我开始升级主应用,过程原本也很顺利,直到出现以下错误:

2417659.54670619 Compressing: discourse/tests/theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js
uglifyjs '/var/www/discourse/public/assets/discourse/tests/_theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js' -m -c -o '/var/www/discourse/public/assets/discourse/tests/theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js' --source-map "base='/var/www/discourse/public/assets/discourse/tests',root='/assets/discourse/tests',url='/assets/discourse/tests/theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js.map'"
Parse error at _theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js:27887,17
define("sinon", () => {
                 ^
ERROR: Unexpected token: punc «)»
    at JS_Parse_Error.get (eval at <anonymous> (/usr/lib/node_modules/uglify-js/tools/node.js:18:1), <anonymous>:71:23)
    at fatal (/usr/lib/node_modules/uglify-js/bin/uglifyjs:409:27)
    at run (/usr/lib/node_modules/uglify-js/bin/uglifyjs:347:9)
    at Object.<anonymous> (/usr/lib/node_modules/uglify-js/bin/uglifyjs:261:5)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
rake aborted!
Errno::ENOENT: No such file or directory @ rb_file_s_size - /var/www/discourse/public/assets/discourse/tests/theme_qunit_helper-205cf3e536cd4118ac1b02aec22cd3f45e8f74826fa96abeb697c0243882e5d2.js
/var/www/discourse/lib/tasks/assets.rake:290:in `size'
/var/www/discourse/lib/tasks/assets.rake:290:in `block (4 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:181:in `block in concurrent?'
/var/www/discourse/lib/tasks/assets.rake:281:in `block (3 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:272:in `each'
/var/www/discourse/lib/tasks/assets.rake:272:in `block (2 levels) in <main>'
/var/www/discourse/lib/tasks/assets.rake:181:in `concurrent?'
/var/www/discourse/lib/tasks/assets.rake:269:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
Docker Manager: FAILED TO UPGRADE
#<RuntimeError: RuntimeError>
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:196:in `run'
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:104:in `upgrade'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:19:in `block in <main>'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `fork'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.5/lib/rails/commands/runner/runner_command.rb:42:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.5/lib/rails/command/base.rb:69:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.5/lib/rails/command.rb:46:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.5/lib/rails/commands.rb:18:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.7.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
bin/rails:17:in `<main>'
Spinning up 2 Unicorn worker(s) that were stopped initially

有人有什么建议,能帮我找出问题所在吗?这是否又是那种虽然 Web 界面支持,但实际上需要通过 CLI 执行的升级?(我之前就因此踩过坑)

谢谢!

是的,确实如此,看来是 2.7.0.beta8 版本需要手动重新构建,详情见 2.7.0.beta8: Share Topic Modal Improvements, Searchable User Fields, Pause Animated Images, and more

奇怪的是,我只有在尝试通过网页界面升级并彻底失败后,才会在 /admin/upgrade 页面看到“您正在运行旧版本的 Discourse 镜像。在您运行最新镜像之前,无法通过网页 UI 进行升级”的提示。如果一开始就显示这条信息,我(也不可能)去尝试了……我确定以前一直是这样工作的……不过,现在已经全部修复了 :slight_smile: